Table of Contents
Node
Node expressions are used to specify nodes within production statements. Every non-void expression is considered as a node expression. The two most common cases are:
- Node creation, from either the constructor or method
- Reference variables created in either the production, or passed by the query
Note: void expressions are simply evaluated and has no further influence on the execution of the
production statements. (e.g. ==> Node println(“xx”) Node; create two Nodes).
Node creation
The syntax for calling the creator of an object is simplified in a production statement. Indeed, the keyword new and empty pairs of parentheses can be omitted.
In the following production statement, two new nodes are created from their constructor (which in java would be new Node()).
==> Node Node;
The downside is that this introduces some amount of ambiguity since Node may
denote both a type of which the constructor has to be invoked, a method or
a variable, but accepting this drawback is justified from a practical point of
view. How ambiguities are resolved is defined in the specification of the XL
programming language.
Reference variable
As for node patterns, a node expression may be prefixed by an identifier and a colon. This declares a new local variable whose name is given by the identifier and whose value is the result of the node expression. This can be used if we need to reference a node at another code location, for example if we want to create a loop within production statements:
==> a:A A A A a
