EBNF for Oberon2 (based on Mossenbock & Wirth, 1993)
========================================================================================
module ::= MODULE ident ";" [importList] declSeq [BEGIN statementSeq]
END ident "."
importList ::= IMPORT [ident ":="] ident {"," [ident ":="] ident} ";"
declSeq ::= { CONST {constDecl ";" }  TYPE {typeDecl ";"}  VAR {varDecl ";"} }
{procDecl ";"  forwardDecl ";"}
constDecl ::= identDef "=" constExpr
typeDecl ::= identDef "=" type
varDecl ::= identList ":" type
procDecl ::= PROCEDURE [receiver] identDef [formalPars] ";" declSeq
[BEGIN statementSeq] END ident
forwardDecl ::= PROCEDURE "^" [receiver] identDef [formalPars]
formalPars ::= "(" [fpSection {";" fpSection}] ")" [":" qualident]
fpSection ::= [VAR] ident {"," ident} ":" type
receiver ::= "(" [VAR] ident ":" ident ")"
type ::= qualident 
ARRAY [constExpr {"," constExpr}] OF type 
RECORD ["("qualident")"] fieldList {";" fieldList} END 
POINTER TO type 
PROCEDURE [formalPars]
fieldList ::= [identList ":" type]
statementSeq ::= statement {";" statement}
statement ::= [ designator ":=" expr  designator ["(" [exprList] ")" ] 
IF expr THEN statementSeq {ELSIF expr THEN statementSeq}
[ELSE statementSeq] END 
CASE expr OF case {"" case} [ELSE statementSeq] END 
WHILE expr DO statementSeq END 
REPEAT statementSeq UNTIL expr 
FOR ident ":=" expr TO expr [BY constExpr] DO statementSeq END 
LOOP statementSeq END 
WITH guard DO statementSeq {"" guard DO statementSeq}
[ELSE statementSeq] END 
EXIT 
RETURN [expr] ]
case ::= [caseLabels {"," caseLabels} ":" statementSeq]
caseLabels ::= constExpr [".." constExpr]
guard ::= qualident ":" qualident
constExpr ::= expr
expr ::= simpleExpr [relation simpleExpr]
simpleExpr ::= ["+"  ""] term {addOp term}
term ::= factor {mulOp factor}
factor ::= designator ["(" [exprList] ")"]  number  character  string 
NIL  set  "(" expr ")"  " ~ " factor
set ::= "{" [element {"," element}] "}"
element ::= expr [".." expr]
relation ::= "="  "#"  "<"  "<="  ">"  ">="  IN  IS
addOp ::= "+"  ""  OR
mulOp ::= " * "  "/"  DIV  MOD  "&"
designator ::= qualident {"." ident  "[" exprList "]"  " ^ " 
"(" qualident ")"}
exprList ::= expr {"," expr}
identList ::= identDef {"," identDef}
qualident ::= [ident "."] ident
identDef ::= ident [" * "  ""]
ident ::= letter {letter  digit}
letter ::= "a"  "b"  ...  "z"  "A"  "B"  ...  "Z"
digit ::= "0"  "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"
number ::= integer  real
integer ::= digit {digit}  digit {hexDigit} "H"
real ::= digit {digit} "." {digit} [scaleFactor]
scaleFactor ::= ("E"  "D") ["+"  ""] digit {digit}
hexDigit ::= digit  "A"  "B"  "C"  "D"  "E"  "F"
string ::= ' " ' {character} ' " '  " ' " {character} " ' "
character ::= *** any printable character other than " or ' ***
characterConst ::= digit {hexDigit} "X"
Note:  separates alternatives.
[] denotes optionality of the enclosed expression.
{} denote its repetition (possibly 0 times).
Terminal symbols are all uppercase (e.g. BEGIN) or in quotes (e.g. ":=").
