Begin
id: GenericToken = "tokenID" ;
{ ";" ":" "," "[" "]" "=" }: SimpleTokens;
{ "." "{" "}" "RECORD" "REF" "ANY" }: SimpleTokens;
{ "LIST" "SEQUENCE" "OF" }: SimpleTokens;
{ "NULL" }: SimpleTokens;
{ "FROM" }: SimpleTokens;
{ "TYPE" }: SimpleTokens;
{ "CEDAR" }: SimpleTokens;
{ "MODULE" "BEGIN" "END" }: SimpleTokens;
MainGoal: NonTerminal;
ModuleBody: NonTerminal;
declist: NonTerminal;
declaration: NonTerminal;
from: NonTerminal;
identlist: NonTerminal;
identlistP: NonTerminal;
typeexp: NonTerminal;
typeid: NonTerminal;
typeidP: NonTerminal;
typecons: NonTerminal;
elementlist: NonTerminal;
elementlistP: NonTerminal;
element: NonTerminal;
reclist: NonTerminal;
variantpair: NonTerminal;
variantpart: NonTerminal;
vcasehead: NonTerminal;
tagtype: NonTerminal;
ident: NonTerminal;
pairlist: NonTerminal;
pairitem: NonTerminal;
typelist: NonTerminal;
MainGoal ← ModuleBody ;
ModuleBody.nosemicolon ← id  ":"  "MODULE"  "="  "BEGIN" declist  "END"  "." ;
ModuleBody.eithsemicolon ← id  ":"  "MODULE"  "="  "BEGIN" declist  ";"  "END"  "." ;
declist.one ← declaration ;
declist.more ← declist  ";" declaration ;
declaration.type ← identlist  "TYPE"  "=" typeexp ;
declaration.cedartype ← identlist  "CEDAR"  "TYPE" from  "=" typeexp ;
from.no ← ;
from.yes ←  "FROM" id ;
identlist ← identlistP ;
identlistP.id ← id  ":" ;
identlistP.idmore ← id  "," identlistP ;
typeexp.id ← id ;
typeexp.typeid ← typeid ;
typeexp.typecons ← typecons ;
typeid.idid ← id id ;
typeid.idtypeid ← id typeid ;
typeid.typeidp ← typeidP ;
typeidP.two ← id  "." id ;
typeidP.more ← typeidP  "." id ;
typecons.elements ←  "{" elementlist  "}" ;
typecons.record ←  "RECORD" reclist ;
typecons.ref ←  "REF" typeexp ;
typecons.refany ←  "REF"  "ANY" ;
typecons.list ←  "LIST"  "OF" typeexp ;
elementlist.empty ← ;
elementlist.nonempty ← elementlistP ;
elementlistP.one ← element ;
elementlistP.more ← elementlistP  "," element ;
element.id ← id ;
reclist.empty ←  "["  "]" ;
reclist.null ←  "NULL" ;
reclist.pairs ←  "[" pairlist  "]" ;
reclist.types ←  "[" typelist  "]" ;
reclist.vpairs ←  "[" pairlist  "," variantpair  "]" ;
reclist.vpart ←  "[" variantpart  "]" ;
reclist.vpair ←  "[" variantpair  "]" ;
variantpair ← identlist variantpart ;
variantpart.seq ←  "SEQUENCE" vcasehead  "OF" typeexp ;
vcasehead.ident ← ident tagtype ;
tagtype.exp ← typeexp ;
ident ← id  ":" ;
pairlist.one ← pairitem ;
pairlist.more ← pairlist  "," pairitem ;
pairitem ← identlist typeexp ;
typelist.typecons ← typecons ;
typelist.typeid ← typeid ;
typelist.id ← id ;
typelist.typeconsmore ← typecons  "," typelist ;
typelist.typeidmore ← typeid  "," typelist ;
typelist.idmore ← id  "," typelist ;
End.