%token identifier number string ARRAY BEGIN BOOLEAN CARDINAL CHOICE DEPENDS END ERROR FALSE INTEGER LONG OF PROCEDURE PROGRAM RECORD REPORTS RETURNS SEQUENCE STRING TRUE TYPE UNSPECIFIED UPON VERSION %% Program : identifier ':' PROGRAM number VERSION number '=' BEGIN DependencyList DeclarationList END '.' | identifier ':' PROGRAM '=' BEGIN DependencyList DeclarationList END '.' ; DependencyList : /* empty */ | DEPENDS UPON ReferencedProgramList ';' ; ReferencedProgramList : ReferencedProgram | ReferencedProgramList ',' ReferencedProgram ; ReferencedProgram : identifier '(' number ')' VERSION number ; DeclarationList : /* empty */ | DeclarationList Declaration ; Declaration : identifier ':' TYPE '=' Type ';' | identifier ':' Type '=' Constant ';' ; Type : PredefinedType | ConstructedType | ReferencedType ; PredefinedType : BOOLEAN | CARDINAL | LONG CARDINAL | INTEGER | LONG INTEGER | STRING | UNSPECIFIED ; ConstructedType : '{' CorrespondenceList '}' | ARRAY NumericValue OF Type | SEQUENCE MaximumNumber OF Type | RECORD '[' FieldList ']' | RECORD '[' ']' | CHOICE DesignatorType OF '{' CandidateList '}' | PROCEDURE ArgumentList ResultList ErrorList | ERROR ArgumentList ; ReferencedType : identifier | identifier '.' identifier ; CorrespondenceList : Correspondence | CorrespondenceList ',' Correspondence ; Correspondence : identifier '(' NumericValue ')' ; MaximumNumber : NumericValue | /* empty */ ; NumericValue : number | ReferencedConstant ; DesignatorType : /* empty */ | ReferencedType ; CandidateList : Candidate | CandidateList ',' Candidate ; Candidate : DesignatorList '=''>' Type ; DesignatorList : Designator | DesignatorList ',' Designator ; Designator : identifier | Correspondence ; ArgumentList : /* empty */ | '[' FieldList ']' ; ResultList : /* empty */ | RETURNS '[' FieldList ']' ; ErrorList : /* empty */ | REPORTS '[' NameList ']' ; FieldList : Field | FieldList ',' Field ; Field : NameList ':' Type ; Constant : PredefinedConstant | ConstructedConstant | ReferencedConstant ; PredefinedConstant : TRUE | FALSE | number | '-' number | '"' string '"' ; ConstructedConstant : identifier | '[' ElementList ']' | '[' ComponentList ']' | '['']' | identifier Constant | number ; ReferencedConstant : identifier | identifier '.' identifier ; ElementList : Constant | ElementList ',' Constant ; ComponentList : Component | ComponentList ',' Component ; Component : NameList ':' Constant ; NameList : identifier | NameList ',' identifier ;