
Grammar extracted by Vadim Zaytsev, see the Grammar Zoo entry for details: modula/modula-3/vinju-storm/extracted
Source used for this grammar: Jurgen Vinju, Tijs van der Storm, Modula-3.sdf, 13 February 2006 – 19 September 2008 [MetaEnv]
Compilation, Interface, Module, GenInf, GenMod, Import, AsImport, FromImport, Block, Decl, GenFmls, GenActls, ImportItem, ConstDecl, TypeDecl, ExceptionDecl, VariableDecl, ProcedureHead, Signature, Formals, Formal, Mode, Raises, Expr, Id, Relop, Addop, Mulop, Selector, Elt, AnyCons, Constructor, Ident, Stmt, Stmts, AssignStmt, CallStmt, CaseStmt, ExitStmt, EvalStmt, ForStmt, IfStmt, LockStmt, LoopStmt, RaiseStmt, RepeatStmt, ReturnStmt, TCaseStmt, TryXptStmt, TryFinStmt, WhileStmt, WithStmt, Case, Label, Handler, TCase, Binding, Actual, QualId, IdList, TypeName, Type, TypeLiteral, ArrayType, PackedType, EnumType, Ancestor, ObjectType, ProcedureType, RecordType, RefType, SetType, SubrangeType, Brand, Fields, Field, Methods, Method, Overrides, Override), 0 root (—), 2 top (Compilation, Ident), 2 bottom (Literal, TextLiteral).Compilation ::= "UNSAFE" InterfaceModuleGenInfGenMod
Interface ::= "INTERFACE" Id ";" Import Decl "END" Id "."
Interface ::= "INTERFACE" Id "=" Id GenActls "END" Id "."
Module ::= "MODULE" Id "EXPORTS" IdList ";" Import Block Id "."
Module ::= "MODULE" Id "EXPORTS" IdList "=" Id GenActls "END" Id "."
GenInf ::= "GENERIC" "INTERFACE" Id GenFmls ";" Import Decl "END" Id "."
GenMod ::= "GENERIC" "MODULE" Id GenFmls ";" Import Block Id "."
Import ::= AsImport
Import ::= FromImport
AsImport ::= "IMPORT" ImportItem "," ImportItem ";"
FromImport ::= "FROM" Id "IMPORT" IdList ";"
Block ::= Decl "BEGIN" Stmts "END"
Decl ::= "CONST" ConstDecl ";"
Decl ::= "TYPE" TypeDecl ";"
Decl ::= "EXCEPTION" ExceptionDecl ";"
Decl ::= "VAR" VariableDecl ";"
Decl ::= ProcedureHead "=" Block Id ";"
Decl ::= "REVEAL" QualId "=""<:" Type ";"
GenFmls ::= "(" IdList ")"
GenActls ::= "(" IdList ")"
ImportItem ::= Id Id "AS" Id
ConstDecl ::= Id ":" Type "=" Expr
TypeDecl ::= Id "=""<:" Type
ExceptionDecl ::= Id "(" Type ")"
VariableDecl ::= IdList ":" Type ":=" Expr
VariableDecl ::=
IdList ":" TypeVariableDecl ::=
IdList ":=" ExprProcedureHead ::=
"PROCEDURE" Id SignatureSignature ::= "(" Formals ")" ":" Type "RAISES" Raises
Formals ::= Formal ";" Formal ";"
Formal ::= Mode IdList ":" Type ":=" Expr
Formal ::= Mode IdList ":" Type
Formal ::= Mode IdList ":=" Expr
Mode ::= "VALUE" "VAR""READONLY"
Raises ::= "{" QualId "," QualId "}" "ANY"
Expr ::=
Expr "OR" ExprExpr ::=
Expr "AND" ExprExpr ::=
"NOT" ExprId ::=
"NOT"Expr ::= Expr Relop Expr
Expr ::= Expr Addop Expr
Expr ::= Expr Mulop Expr
Expr ::=
"+" ExprExpr ::=
"-" ExprExpr ::= Expr Selector
Expr ::=
Id
LiteralConstructorExpr ::= "(" Expr ")"
Relop ::= "=" "#""<""<="">"">=""IN"
Addop ::= "+" "-""&"
Mulop ::= "*" "/""DIV""MOD"
Selector ::=
"^"Selector ::=
"." IdSelector ::= "[" Expr "," Expr "]"
Selector ::= "(" Actual "," Actual ")"
Elt ::=
Expr ".." ExprElt ::= Expr
Elt ::=
Id ":=" ExprAnyCons ::= Elt "," Elt "," ".."
Constructor ::= Type "{" AnyCons "}"
Expr ::=
"+" ExprExpr ::=
"-" ExprIdent ::=
"ABS"Ident ::=
"ADDRESS"Ident ::=
"ADR"Ident ::=
"ADRSIZE"Ident ::=
"BITSIZE"Ident ::=
"BOOLEAN"Ident ::=
"BYTESIZE"Ident ::=
"CARDINAL"Ident ::=
"CEILING"Ident ::=
"CHAR"Ident ::=
"DEC"Ident ::=
"DISPOSE"Ident ::=
"FALSE"Ident ::=
"FIRST"Ident ::=
"FLOAT"Ident ::=
"FLOOR"Ident ::=
"INC"Ident ::=
"INTEGER"Ident ::=
"ISTYPE"Ident ::=
"LAST"Ident ::=
"LONGFLOAT"Ident ::=
"LONGREAL"Ident ::=
"LOOPHOLE"Ident ::=
"MAX"Ident ::=
"MIN"Ident ::=
"MUTEX"Ident ::=
"NARROW"Ident ::=
"NEW"Ident ::=
"NIL"Ident ::=
"NULL"Ident ::=
"NUMBER"Ident ::=
"ORD"Ident ::=
"REAL"Ident ::=
"REFANY"Ident ::=
"ROUND"Ident ::=
"SUBARRAY"Ident ::=
"TEXT"Ident ::=
"TRUE"Ident ::=
"TRUNC"Ident ::=
"TYPECODE"Ident ::=
"VAL"Stmt ::= AssignStmt
Stmt ::= Block
Stmt ::= CallStmt
Stmt ::= CaseStmt
Stmt ::= ExitStmt
Stmt ::= EvalStmt
Stmt ::= ForStmt
Stmt ::= IfStmt
Stmt ::= LockStmt
Stmt ::= LoopStmt
Stmt ::= RaiseStmt
Stmt ::= RepeatStmt
Stmt ::= ReturnStmt
Stmt ::= TryFinStmt
Stmt ::= TryXptStmt
Stmt ::= TCaseStmt
Stmt ::= WhileStmt
Stmt ::= WithStmt
Stmts ::= Stmt ";" Stmt ";"
AssignStmt ::=
Expr ":=" ExprCallStmt ::= Expr "(" Actual "," Actual ")"
CaseStmt ::= "CASE" Expr "OF" "|" Case "|" Case "ELSE" Stmts "END"
ExitStmt ::=
"EXIT"EvalStmt ::=
"EVAL" ExprForStmt ::= "FOR" Id ":=" Expr "TO" Expr "BY" Expr "DO" Stmts "END"
IfStmt ::= "IF" Expr "THEN" Stmts "ELSIF" Expr "THEN" Stmts "ELSE" Stmts "END"
LockStmt ::= "LOCK" Expr "DO" Stmts "END"
LoopStmt ::= "LOOP" Stmts "END"
RaiseStmt ::= "RAISE" QualId "(" Expr ")"
RepeatStmt ::= "REPEAT" Stmts "UNTIL" Expr
ReturnStmt ::= "RETURN" Expr
TCaseStmt ::= "TYPECASE" Expr "OF" "|" TCase "|" TCase "ELSE" Stmts "END"
TryXptStmt ::= "TRY" Stmts "EXCEPT" "|" Handler "|" Handler "ELSE" Stmts "END"
TryFinStmt ::= "TRY" Stmts "FINALLY" Stmts "END"
WhileStmt ::= "WHILE" Expr "DO" Stmts "END"
WithStmt ::= "WITH" Binding "," Binding "DO" Stmts "END"
Case ::= Label "," Label "=>" Stmts
Label ::= Expr ".." Expr
Handler ::= QualId "," QualId "(" Id ")" "=>" Stmts
TCase ::= Type "," Type "(" Id ")" "=>" Stmts
Binding ::=
Id "=" ExprActual ::= TypeLiteral Id ":=" Expr
QualId ::= Id "." Id
IdList ::= Id "," Id
TypeName ::= "ROOT" "UNTRACED" "ROOT"
Id ::=
"ROOT"Type ::= TypeLiteral
Type ::= QualId
TypeLiteral ::= ArrayType
TypeLiteral ::= PackedType
TypeLiteral ::= EnumType
TypeLiteral ::= ObjectType
TypeLiteral ::= ProcedureType
TypeLiteral ::= RecordType
TypeLiteral ::= RefType
TypeLiteral ::= SetType
TypeLiteral ::= SubrangeType
TypeLiteral ::= "(" Type ")"
TypeLiteral ::= TypeName
ArrayType ::= "ARRAY" Type "," Type "OF" Type
PackedType ::= "BITS" Expr "FOR" Type
EnumType ::= "{" IdList "}"
Ancestor ::=
TypeName
ObjectTypeQualIdObjectType ::= Ancestor Brand "OBJECT" Fields "METHODS" Methods "OVERRIDES" Overrides "END"
ProcedureType ::=
"PROCEDURE" SignatureRecordType ::= "RECORD" Fields "END"
RefType ::= "UNTRACED" Brand "REF" Type
SetType ::= "SET" "OF" Type
SubrangeType ::= "[" Expr ".." Expr "]"
Brand ::= "BRANDED" TextLiteral
Fields ::= Field ";" Field ";"
Field ::= IdList ":" Type ":=" Expr
Field ::=
IdList ":" TypeField ::=
IdList ":=" ExprMethods ::= Method ";" Method ";"
Method ::= Id Signature ":=" Expr
Overrides ::= Override ";" Override ";"
Override ::=
Id ":=" Expr