Syntax
This and the next sections contain the lexical and syntactical rules defining the action language.
Character set
The action language uses a character set corresponding to UNICODE. In the following, we denote characters and character sequences between apostrophes (‘’). For designating characters we use the usual symbols or the C escape sequences (for non-printable characters e.g. ‘\n’ or ‘\r’).
White Spaces
White spaces are defined as: space (‘ ‘), tab (‘\t’) or new line (‘\n’ or ‘\r’). White spaces may appear between any two tokens in an action specification and are ignored.
Comments
There are two forms of comments:
-
‘/*text*/’ where text is any character sequence not containing the subsequence ‘*/’
-
‘//text’ where text is any character sequence containing exactly one new line (‘\n’ or ‘\r’) at the end of the sequence.
Comments may appear between any two tokens in an action specification and are ignored.
Identifiers
An identifier is an unlimited-length sequence of letters and digits, the first of which must be a letter. Identifiers are denoted in the grammar by the token IDENTIFIER, defined by the following regular expression:
IDENTIFIER ::= NONDIGIT ( NONDIGIT + DIGIT )*
NONDIGIT ::= '_' + 'A' + ... + 'Z' + 'a' + ... + 'z'
DIGIT ::= '0' + '1' + ... + '9'
Keywords
The following character sequences are reserved for use as keywords and cannot be used as identifiers.
FOR ::= ‘for’
IF ::= ‘if’
NEW ::= ‘new’
RETURN ::= ‘return’
THIS ::= ‘this’
WHILE ::= ‘while’
Literals
The following character sequences are reserved for use as literals denoting values of supported elementary types (integer and boolean).
-
Boolean literals
-
FALSE::=‘false’
-
TRUE::=‘true’
-
-
Integer literals
-
INTEGER_LITERAL::=DIGIT(DIGIT)*
-
-
Object reference literal
-
NULL::=‘null’
-
-
String literal
-
STRING_LITERAL::=‘”text”’
where text is any character sequence containing neither new lines (‘\n’ or ‘\r’) nor ‘”’.
-