Previous Contents Next

2   Lexical conventions

Blanks

The following characters are considered as blanks : space, newline and horizontal tabulation. Blanks separate adjacent identifiers, literals and keywords that would be otherwise confused as a single identifier, literal or keyword. Apart from that, they are ignored.

Comments

Comments are C-like comments. They start with the two characters /* and end with the characters */. C++ comments style can also be used; all characters from the two characters // till the end of the line are considered as comments too. Comments are treated as blanks.

Identifiers

Identifiers are a sequence of letters, digits and _ (the underscore character) starting with a letter. A letter can be any of the 52 lowercase and uppercase letters from the ASCII set. The current implementation places no limit on the number of characters of an identifier.
ident   ::=   letter (letter | digit | _) *
letter   ::=   A..Z | a..z
digit   ::=   0..9

Integer literals

An integer literal is a sequence of one or more digits, optionally preceded by a minus sign. By default, integers literals are in decimal (radix 10).
integer-literal   ::=   (0..9) +
  | 0x (0..9 | A..F | a..f) +
  | 0o (0..7) +
The following prefixes select a different radix:
Prefix Radix
0x hexadecimal (radix 16)
0o octal (radix 8)
Note that the initial 0 is digit zero and the o for octal is letter o.

Boolean literals

The boolean type has two possible values, represented by the literals true and false. A boolean literal is always of type boolean.
boolean-literal   ::=   true
  | false

Bit literals

Bit literals are delimited by ' (single quote) characters.
bits-literal   ::=   ' (bit) + '
bit   ::=   0 | 1 | * | .

Prefix and infix operators

The following tokens are the Devil operators :

@ .. . => <= <=>
= #
+ - * /
== != < > >=
&& || !


Note that sequences of ``operator characters'', such as != or <=> are read as a single token.

Keywords

The identifiers below are reserved keywords:



The following character sequences are also reserved:



Ambiguities

Lexical ambiguities are resolved according to the ``longest match'' rule: when a character sequence can be decomposed into tokens in several different ways, the resulting decomposition is the one with the longest first token.


Previous Contents Next