This page demonstrates language implementation techniques using a small formal language with the following grammar.
<program> ::= start <statement>* end <statement> ::= <assignment_statement> | <output_statement> <assignment_statement> ::= <identifier> = <expression> <output_statement> ::= print ( <expression> ) <expression> ::= <identifier> | <number> <identifier> ::= /[a-zA-Z]+[a-zA-Z0-9_]*/ <number> ::= /[0-9]+/
In addition, comments consisting of any characters starting with /*
and ending with */
will be ignored.