Peter and dtoffe: a basic one<program> ::= "MODULE" <identifier> ";"
[ "IMPORT" <import-list> ";" ]
<block>
<identifier> "." .
<import-list> ::= <identifier> { "," <identifier> }
<block> ::= { <declaration> ";" }
"BEGIN"
{ <statement> ";" }
"END" .
<declaration> ::= <constant-declaration>
| <type-declaration>
| <variable-declaration>
| <procedure-declaration>
| <module-declaration>
<constant-declaration> ::= "CONST" { <identifier> "=" <constant> ";" }
<type-declaration> ::= "TYPE" { <identifier> "=" <type> ";" }
<variable-declaration> ::= "VAR" { <identifier-list> ":" <type> ";" }
<procedure-declaration> ::= "PROCEDURE" <identifier> [ "(" <formal-parameters> ")" ] ";"
<block> <identifier> .
<module-declaration> ::= "MODULE" <identifier> [ ";" <import-list> ] <block> <identifier> .
<formal-parameters> ::= [ "VAR" ] <identifier-list> ":" <type>
{ ";" [ "VAR" ] <identifier-list> ":" <type> }
<type> ::= <simple-type> | <array-type> | <record-type> | <pointer-type> | <procedure-type>
<simple-type> ::= <identifier> | "INTEGER" | "BOOLEAN" | "CHAR" | "REAL" | enumeration | subrange
<array-type> ::= "ARRAY" <index-range> "OF" <type>
<record-type> ::= "RECORD" { <identifier-list> ":" <type> ";" } "END"
<pointer-type> ::= "POINTER" "TO" <type>
<procedure-type> ::= "PROCEDURE" [ "(" [ <formal-parameters> ] ")" ]
<statement> ::= <assignment>
| <procedure-call>
| <if-statement>
| <case-statement>
| <while-statement>
| <repeat-statement>
| <for-statement>
| <loop-statement>
| <exit-statement>
| <return-statement>
| <with-statement>
<assignment> ::= <designator> ":=" <expression>
<procedure-call> ::= <designator> [ "(" <actual-parameters> ")" ]
<if-statement> ::= "IF" <expression> "THEN" <statement-sequence>
{ "ELSIF" <expression> "THEN" <statement-sequence> }
[ "ELSE" <statement-sequence> ]
"END"
<case-statement> ::= "CASE" <expression> "OF"
{ <case-label> ":" <statement-sequence> "|" }
[ "ELSE" <statement-sequence> ]
"END"
<while-statement> ::= "WHILE" <expression> "DO" <statement-sequence> "END"
<repeat-statement> ::= "REPEAT" <statement-sequence> "UNTIL" <expression>
<for-statement> ::= "FOR" <identifier> ":=" <expression> "TO" <expression> [ "BY" <constant> ] "DO"
<statement-sequence> "END"
<loop-statement> ::= "LOOP" <statement-sequence> "END"
<exit-statement> ::= "EXIT"
<return-statement> ::= "RETURN" [ <expression> ]
<with-statement> ::= "WITH" <designator> "DO" <statement-sequence> "END"
<expression> ::= <simple-expression> [ <relation> <simple-expression> ]
<relation> ::= "=" | "#" | "<" | "<=" | ">" | ">=" | "IN"
<simple-expression> ::= [ "+" | "-" ] <term> { <add-op> <term> }
<term> ::= <factor> { <mul-op> <factor> }
<factor> ::= <number> | <string> | <designator> | "NIL" | "(" <expression> ")" | "NOT" <factor>
<designator> ::= <identifier> { "." <identifier> | "[" <expression-list> "]" | "^" }
<actual-parameters> ::= <expression> { "," <expression> }
<statement-sequence> ::= { <statement> ";" }
It is pure BNR. It has no correction recovery for corner cases.