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


3 Syntax

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

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

We define each of these categories below.

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 a variable denotes the set of instantiates 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.

The last three are evaluable expressions that denote a ground term.

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

A ground term is a term containing no variables.

QuLog function call evaluation is strict. A function call argument is completely evaluated just before the function call in which it appears is evaluated.

A code name is a value of system type code. For example append and *

Both term and code are sub-types of system type top

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.


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