Next: , Previous: , Up: Top [Contents][Index]


4 Syntax

This section informally describes the concrete syntax of QuLog. There is a formal extended BNF syntax in EBNF Grammar for QuLog/TeleoR.

The basic building block is an expression. An expression is a: data constant (aka atomic value), variable, compound term, list, set, function call, list comprehension, set comprehension.

We define each of these categories below. The last three are evaluable expressions.

A reader unfamiliar with logic programming might find it odd that a variable is considered a data value. However in both QuLog and Prolog variables are first class values and can be passed between calls and embedded in lists and other compound terms, but not in sets. An answer to a query that contains variables are all the instantiations of that answer where the variable is replaced by any value of its type. The ability to pass around terms that are or which contain variables is a powerful programming feature of QuLog and Prolog. It is not a feature of Datalog or Answer Set Logic Programming.

A term is a: data constant, variable, a simple compound term (see below) all arguments of which are terms, a list of terms, a set (which can only contain ground terms).

A ground term is a: data constant, a list or simple compound term term containing no variables, a set.

QuLog function call evaluation is strict. A function call argument is completely evaluated just before the function call in which it appears is evaluated. Functions always return ground term values.

A ground expression is an expression that contains no variables, or is such that all its variables are bound to ground values at the point that the expression is evaluated. All function calls must be ground at the time they are evaluated.


Next: , Previous: , Up: Top [Contents][Index]

On This Site