Special Syntax

We provide some syntax extensions in the spirit of SWI-Prolog 7 [10]. To allow a richer syntax we additionally allow closed lists, singleton sets and unit atoms as operators, thus providing additional parameters when forming a term. The resulting special syntax provides convenience for array subscripts, tagged structures and zero arguments.

operator      --> atom
| "[" arguments "]"
| "{" term(1200) "}"
| "(" ")"
 | "|" | "," | ".".

A postfix list X0 [X1, .., Xn] expression is parsed as an array index term sys_index(X0, X1, .., Xn) when the operator sys_index is defined as postfix. The postfix empty set X0 {} and singleton set X0 {X1} expressions are parsed as dictionary terms sys_struct(X0) respectively sys_struct(X0, X1) when the operator sys_struct is defined as postfix.

A[I, J]		% is an array index term
point{x:1, y:2} % is an dictionary term
dist() % is a zero argument term

A further special syntax allows zero argument terms. For this purpose, the compound syntax has been extended to accept an empty argument list. Further, the expression syntax has as well be accepted to accept a unit atom. An empty argument list is not mapped to a zero argument compound but to a unit atom postfix expression.

When writing out a term canonically operator definitions are ignored an expressions are written as compound. During non-canonical write, expressions are written back as expressions. Fur-ther parenthesis are put where the mix of operator level demands it. Finally, escaped operators are put in parenthesis when necessary.