The syntax is described in Extended Backus Naur Form. Syntactic constructs are denoted by (abbreviated) English words consisting of upper- and lower-case letters, and containing at least one lower-case letter. The angular brackets < and > are omitted. Strings of letters consisting solely of upper-case letters stand for themselves, i.e. for reserved identifiers of the language. Strings of characters enclosed in single quotes ' ' are also to be taken literally. Square brackets [ ] denote optional constructs. Curly brackets { } stand for zero or more repetitions of the enclosed construct. Alternative constructs are separated by a vertical bar |. Parentheses ( ) are used for grouping.
The basic vocabulary of MiniLAX consists of basic symbols classified into delimiters, identifiers, and constants.
Spaces, line ends, and comments may occur anywhere in a program except within a basic symbol. At least one space, line end or comment must occur between any two adjacent identifiers or constants. Otherwise, spaces, line ends, and comments do not influence the meaning of a program.
A comment has the form
'(*' any sequence of characters not containing *) '*)'
Delim ::= ':' | ';' | ':=' | '(' | ')' | '.' | ',' | '..' | '[' | ']' | '+' | '*' | '<' | 'ARRAY' | 'BEGIN' | 'BOOLEAN' | 'DECLARE' | 'DO' | 'ELSE' | 'END' | 'FALSE' | 'IF' | 'INTEGER' | 'NOT' |'OF' | 'PROCEDURE' | 'PROGRAM' | 'READ' | 'REAL' |'THEN' | 'TRUE' | 'VAR' | 'WHILE' | 'WRITE'
Id ::= Letter { Letter | Digit }All letters and digits of an identifier are significant. Upper and lower case letters are distinguished. Delimiters are reserved identifiers that cannot be used otherwise.
IntConst ::= Digit { Digit } RealConst ::= [ IntConst ] '.' IntConst [ ScaleFactor ] ScaleFactor ::= 'E' [ '+' | '-' ] IntConstExamples:
1 100 .1 87.35E-8