
Grammar connected by Vadim Zaytsev, see the Grammar Zoo entry for details: modula/modula-3/vinju-storm/connected
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, Relop, Addop, Mulop, Selector, Elt, AnyCons, Constructor, 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, Literal, Id, CharLiteral, TextLiteral, TextContents, Escape, Number, FloatNumber, Exponent, PrintingChar, HexDigit, Digit, OctalDigit, Letter, OtherChar), 1 root (Compilation), 0 top (—), 0 bottom (—).Compilation ::= "UNSAFE" InterfaceModuleGenInfGenMod
Interface ::= "INTERFACE" Id ";" Import Decl "END" Id "." "INTERFACE" Id "=" Id GenActls "END" Id "."
Module ::= "MODULE" Id "EXPORTS" IdList ";" Import Block Id "." "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 FromImport
AsImport ::= "IMPORT" ImportItem "," ImportItem ";"
FromImport ::= "FROM" Id "IMPORT" IdList ";"
Block ::= Decl "BEGIN" Stmts "END"
Decl ::= "CONST" ConstDecl ";" "TYPE" TypeDecl ";" "EXCEPTION" ExceptionDecl ";" "VAR" VariableDecl ";" ProcedureHead "=" Block Id ";" "REVEAL" QualId "=""<:" Type ";"
GenFmls ::= "(" IdList ")"
GenActls ::= "(" IdList ")"
ImportItem ::=
Id
Id "AS" IdConstDecl ::= Id ":" Type "=" Expr
TypeDecl ::= Id "=""<:" Type
ExceptionDecl ::= Id "(" Type ")"
VariableDecl ::= IdList ":" Type ":=" Expr IdList ":" Type IdList ":=" Expr
ProcedureHead ::=
"PROCEDURE" Id SignatureSignature ::= "(" Formals ")" ":" Type "RAISES" Raises
Formals ::= Formal ";" Formal ";"
Formal ::= Mode IdList ":" Type ":=" Expr Mode IdList ":" Type Mode IdList ":=" Expr
Mode ::= "VALUE" "VAR" "READONLY"
Raises ::= "{" QualId "," QualId "}" "ANY"
Expr ::= Expr "OR" Expr Expr "AND" Expr "NOT" Expr Expr Relop Expr Expr Addop Expr Expr Mulop Expr "+" Expr "-" Expr Expr Selector Id Literal Constructor "(" Expr ")"
Relop ::= "=" "#" "<" "<=" ">" ">=" "IN"
Addop ::= "+" "-" "&"
Mulop ::= "*" "/" "DIV" "MOD"
Selector ::= "^" "." Id "[" Expr "," Expr "]" "(" Actual "," Actual ")"
Elt ::= Expr ".." Expr Expr Id ":=" Expr
AnyCons ::= Elt "," Elt "," ".."
Constructor ::= Type "{" AnyCons "}"
Stmt ::= AssignStmt Block CallStmt CaseStmt ExitStmt EvalStmt ForStmt IfStmt LockStmt LoopStmt RaiseStmt RepeatStmt ReturnStmt TryFinStmt TryXptStmt TCaseStmt WhileStmt 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"
Type ::= TypeLiteral QualId
TypeLiteral ::= ArrayType PackedType EnumType ObjectType ProcedureType RecordType RefType SetType SubrangeType "(" Type ")" TypeName
ArrayType ::= "ARRAY" Type "," Type "OF" Type
PackedType ::= "BITS" Expr "FOR" Type
EnumType ::= "{" IdList "}"
Ancestor ::= TypeName ObjectType QualId
ObjectType ::= 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 IdList ":" Type IdList ":=" Expr
Methods ::= Method ";" Method ";"
Method ::= Id Signature ":=" Expr
Overrides ::= Override ";" Override ";"
Override ::=
Id ":=" ExprLiteral ::= Number FloatNumber CharLiteral TextLiteral
Id ::= Letter LetterDigit"_""NOT""ROOT"
CharLiteral ::= "'" PrintingChar Escape """ "'"
TextLiteral ::= """ TextContents """
TextContents ::= PrintingCharEscape
Escape ::= "\\n" "\\t" "\\r" "\\f" "\\\\" "'" "\\" "\\" OctalDigit OctalDigit OctalDigit
Number ::= Digit Digit Digit Digit "_" HexDigit HexDigit
FloatNumber ::= Digit Digit "." Digit Digit Exponent
Exponent ::= "E""e""D""d""X""x" "+""-" Digit Digit
PrintingChar ::= Letter Digit OtherChar
HexDigit ::= Digit "A" "B" "C" "D" "E" "F" "a" "b" "c" "d" "e" "f"
Digit ::= "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
OctalDigit ::= "0" "1" "2" "3" "4" "5" "6" "7"
Letter ::= "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
OtherChar ::= "\<" "\>" "\" "\!" "\?" "\#" "\$" "\%" "\&" "\(" "\)" "\*" "\+" "\," "\-" "\." "\/" "\:" "\;" "\_" "\`" "\{" "\}" "\~" "\[" "\]" "\|" "\^" "\="