Chapter 3. Language Reference

Table of Contents

Language Elements
Set Expressions
Simple Set Expressions
Commands and Miscellaneous Set Expressions
Value Expressions
Set Operators
Logical Operators
Value Operators

The interpreter accepts requests and returns sets of objects. A request contains one or more set expressions; if a request contains multiple set expressions they are separated by semi-colons [;]. The details of how the objects are returned for each set expression depend on the environment.

Language Elements

A set expression consists of a sequence of tokens. White space or punctuation delimits tokens. A token may be punctuation, a constant, a name, or a reserved word. Names and reserved words consist of a string of alphanumeric characters or underscores starting with a letter or underscore. Reserved words will always start with a lower-case letter.

The only permissable punctuation within a set expression are parentheses, which are used for grouping in set expressions, filters or transforms; commas, which are used with certain operators; the value operators, and the regular expression matching operator ~. Punctuation tokens are recognized as tokens in themselves and don't have to be set off with whitespace.

There are two kinds of constants, integers and strings. Integer constants are a string of decimal digits and must specify a number between 0 and 2^32 -1 . There are two types of string constants:

  • Quoted strings constants are enclosed in double quotation marks ("); double quotation marks or backslashes within the string must be escaped by a backslash.
  • Slash-string constants are introduced with two forward slashes (//) and extend to the next forward slash. Forward slashes within the string may be escaped with a preceding backslash (\), but when backslashes do not immediately precede forward slashes they are not treated specially. This makes slash-strings convenient for regular expressions, where you might have to use a lot of backslashes, but slash-strings have no special meaning and may be used interchangably with quoted strings.

Certain operators (~, ~=, substitute()) take regular expressions. Regular expressions can be contained in either kind of string constant, and are Java regular expressions as defined in the documentation for java.util.regex.Pattern.

A sequence of one or more reserved words represents a set operator, a logical operator, a simple set expression, a filter or a transform.

Names are words that must not conflict with any of the reserved words, and must reference an expression or transform previously defined with the set command.

A valid set expression consists of one of the set expressions defined in the language, a name that had been defined as a set expression, a scalar value expression, a set expression with a transform prepended, two set expressions joined by one of the set operators, or a set expression enclosed within parentheses.

A transform is one of the transforms defined by the language, a name that has been defined as a transform, a transform with another transform appended, two transforms joined by one of the set operators, a filter, a count-preserving or group value expression, or a transform enclosed within parentheses.

A filter is one of the filters defined in the language, a filter with the reserved word not prepended, two filters joined by the logical operators and or or, two value expressions related by one of the relational operators, or a filter enclosed within parentheses.

A value expression is a constant, one of the value expression operators defined in the language, two value expressions with compatible context combined with value operators, or a value expression enclosed within parentheses.

Reserved Words:

anyimport Javasame
assembly C#internal C#/CILstring
castnamespace C#/CILtypes
catchesnamespaces C#/CILuncalled
countpackage Javaunset
datepackages Javausing C#/CIL
deprecated Javapreviouswithout

Reserved words all start with a lowercase letter. Therefore, it is a convention of the language that user defined operators (for set expressions or transforms) start with an uppercase letter; this will distinguish them from current and future reserved words.

browse-by-query home antlersoft free software sourceforge project page