<> <> <> <> <<>> SiroccoParser: Control Module; Wart: Module = Begin Generic: EnumeratedBaseType = {array, boolean, bulkDataSink, bulkDataSource, cardinal, choice, enumeration, error, integer, longCardinal, longInteger, procedure, record, sequence, string, unspecified}; <> identifier: GenericToken = "tokenID"; numberD: GenericToken = "tokenDECIMAL"; numberO: GenericToken = "tokenOCTAL"; numberH: GenericToken = "tokenHEX"; Rope: GenericToken = "tokenROPE"; <> <<>> <> BOOLEAN: CedarType; CARDINAL: CedarType; CARD: CedarType; NAT: CedarType; INT: CedarType; <> <<>> CComponent: CedarType From SiroccoPrivate; CType: CedarType From SiroccoPrivate; EqualProc: CedarType From HashTable; FunctionList: CedarType From SiroccoPrivate; HashProc: CedarType From HashTable; Key: CedarType From HashTable; ROPE: CedarType From Rope; SeqIndex: CedarType From HashTable; Table: CedarType From HashTable; TABLES: CedarType From SiroccoPrivate; Value: CedarType From HashTable; <<>> <> Cat: CedarFunction [ROPE.a, ROPE.b, ROPE.c] Returns [ROPE.d] From Rope; <> Concat: CedarFunction [ROPE.a, ROPE.b] Returns [ROPE.c] From Rope; Equal: CedarFunction [ROPE.a, ROPE.b] Returns [BOOLEAN] From Rope; Fetch: CedarFunction [Table, ROPE] Returns [BOOLEAN, Value] From HashTable; Nest: CedarFunction [ROPE.a, NAT.level] Returns [ROPE.b] From SiroccoPrivate; NewFcn: CedarFunction [ROPE.name, ROPE.obj, INT.size] Returns [ROPE.out] From SiroccoPrivate; RopeFromCard: CedarFunction [CARD] Returns [ROPE] From Convert; RopeFromInt: CedarFunction [INT] Returns [ROPE] From Convert; End; ParserPrivate: Module = Begin <> card: BaseFunction [INT] Returns [CARD]; int: BaseFunction [CARD] Returns [INT]; nat: BaseFunction [INT] Returns [NAT]; <> GetCardFromDecimal: BaseFunction [numberD] Returns [CARD]; GetCardFromOctal: BaseFunction [numberO] Returns [CARD]; GetCardFromHex: BaseFunction [numberH] Returns [CARD]; RopeTokenToROPE: BaseFunction [Rope] Returns [ROPE]; <> CopyRope: BaseFunction [ROPE.a] Returns [ROPE.b]; CopyTables: BaseFunction [TABLES.ARG] Returns [TABLES.RES]; CopyAll: BaseFunction [ROPE.ARG, FunctionList.ARG, TABLES.ARG] Returns [ROPE.RES, FunctionList.RES, TABLES.RES]; <> CreateCanonicalKey: BaseFunction [identifier, numberD.prog, numberD.val] Returns [ROPE]; CreateKey: BaseFunction [identifier] Returns [ROPE]; <<>> <> CopyFunctionList: BaseFunction [FunctionList.ARG] Returns [FunctionList.RES]; CreateTables: BaseFunction Returns [TABLES]; DiskToTable: BaseFunction [TABLES.ARG, identifier, numberD.progno, numberD.verno] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; FetchFromGlobalTable: BaseFunction [TABLES.ARG, ROPE] Returns [Table]; <<>> <> CheckCanonicalType: BaseFunction [ROPE.type, ROPE.constant, TABLES.ARG] Returns [TABLES.RES]; CheckResultsForSourceAndSink: BaseFunction [CComponent] Returns [INT]; -- actually BOOLEAN CompareTypes: BaseFunction [CType.a, CType.b, TABLES] Returns [INT]; -- actually BOOLEAN GetCType: BaseFunction [identifier, CComponent, TABLES] Returns [CType, ROPE]; GetLengthOfCComponentList: BaseFunction [CComponent, INT.arg] Returns [INT.res]; SeeIfArrOrSeq: BaseFunction [CType.arg, INT, TABLES] Returns [CType.res, ROPE]; <<>> <> AddOne: BaseFunction [INT.ARG] Returns [INT.RES] DamagedReps [INT.ARG]; <> <<>> CopyCComponent: BaseFunction [CComponent.arg] Returns [CComponent.res]; GetCTypeFirstChild: BaseFunction [CType] Returns [CComponent]; MkCComponent: BaseFunction [ROPE.name, INT.valBinding, ROPE.typeBinding, CComponent.sibling] Returns [CComponent]; MkCType: BaseFunction [Generic.class, INT.bound, CComponent.firstChild] Returns [CType]; MkNILCComponent: BaseFunction [] Returns [CComponent]; <<>> <> <<>> ValueToConstant: BaseFunction [Value] Returns [Constant]; ValueToRope: BaseFunction [Value] Returns [ROPE]; ValueToRopeConstant: BaseFunction [Value, ROPE.a] Returns [ROPE.b] DamagedReps [ROPE.a]; <> <<>> Copy: BaseFunction [ROPE.arg, CType.arg, Constant.arg, TABLES.arg] Returns [ROPE.res, CType.res, Constant.res, TABLES.res]; FetchFromTypeTable: BaseFunction [TABLES.ARG, ROPE] Returns [CType]; GetObjectName: BaseFunction [ROPE.type, TABLES] Returns [ROPE.typeobject]; MakeUpFunctionName: BaseFunction [] Returns [ROPE.name]; Remove: BaseFunction [identifier, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; SendError: BaseFunction [ROPE] Returns [CARD]; <<>> <> <<>> IntoCondensedFunctionTable: BaseFunction [ROPE.functionName, ROPE.function, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; IntoUnresolvedConstantTable: BaseFunction [TABLES.ARG, ROPE.key, Type.value, Constant.value] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; IntoUnresolvedTypeTable: BaseFunction [TABLES.ARG, ROPE.key, Type.value] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; <> <<>> ClearWorkTable: BaseFunction [TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; EnterNamesIntoWorkTable: BaseFunction [CType, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; FillWorkTable: BaseFunction [CType, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; <> <<>> AddLocalConstantToRope: BaseFunction [identifier, ROPE.constantName, ROPE.constantType, FunctionList.functionList, ROPE.a, TABLES.ARG] Returns [ROPE.b, FunctionList.RES, TABLES.RES] DamagedReps [ROPE.a, FunctionList.functionList, TABLES.ARG]; CanonicaliseLocalReferenceType: BaseFunction [identifier, TABLES.ARG] Returns [ROPE, CType, TABLES.RES] DamagedReps [TABLES.ARG]; GetConstantType: BaseFunction [identifier, TABLES.ARG] Returns [ROPE, CType, Constant, TABLES.RES] DamagedReps [TABLES.ARG]; TryToCoerceNumber: BaseFunction [CType, CARD] Returns [INT]; <> <<>> Array: BaseFunction [ROPE.type, TABLES] Returns [BOOLEAN];-- Sees if type is array CheckIfEmpty: BaseFunction [TABLES.ARG] Returns [TABLES.RES]; CompareClass: BaseFunction [CType, Generic.b] Returns [CComponent]; InsureErrorType: BaseFunction [identifier, TABLES.ARG] Returns [TABLES.RES]; IsEnumerationConstant: BaseFunction [CType, identifier] Returns [INT]; NotEnumeration: BaseFunction [CType] Returns [BOOLEAN]; SeeIfDuplicated: BaseFunction [TABLES.ARG, identifier, CARD] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; SeeIfInt: BaseFunction [CType] Returns [BOOLEAN]; <> <<>> AddFunctionList: BaseFunction [Value, FunctionList.ARG] Returns [FunctionList.RES] DamagedReps [FunctionList.ARG]; AddFunctionToTable: BaseFunction [Value, FunctionList, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; ConsFunctionList: BaseFunction [FunctionList.arg, ROPE] Returns [FunctionList.res] DamagedReps [FunctionList.arg]; GetTypeOfComponent: BaseFunction [identifier, ROPE.arg, TABLES] Returns [ROPE.TypeOfSequence]; TypeOfSequence: BaseFunction [ROPE.sequenceName, TABLES] Returns [ROPE.TypeOfSequence]; End; AbstractTypes: Module = Begin <> Program: AbstractType [MakeSymbolTable]; ReferencedProgramList: AbstractType [ReadInTable]; ReferencedProgram: AbstractType [ReadInTable]; DeclarationList: AbstractType [BuildTable, RecordNames]; Declaration: AbstractType [BuildTable, RecordNames]; Type: AbstractType [CanonicaliseType]; CorrespondenceList: AbstractType [CanonicaliseCorrespondenceList, CheckCorrespondenceList]; CandidateList: AbstractType [CanonicaliseCandidateList, EmptyWorkTableOfNames]; FieldList: AbstractType [CanonicaliseFieldList]; -- I want a FIELD type (ajd) Constant: AbstractType [Coerce, GetCARDINAL, ConstantToRope]; ElementList: AbstractType [CoerceElementList, ConstantToRope, Size, ConstructFunction]; ComponentList: AbstractType [CoerceComponents, ConstantToRope, CheckAllNames]; Component: AbstractType [CoerceComponents, ConstantToRope, CheckAllNames]; NameList: AbstractType [CheckIfErrorNames, CanonicaliseFieldsFromNameList, CoerceComponentNameList, NameListToRope, EmptyWorkTableOfNames, TypeOfNameList]; number: AbstractType [GetCARDINAL, NumberToCard]; <> BuildTable: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CanonicaliseCandidateList: TreeRecursiveFunction [Tree, CComponent.arg, CType, TABLES.ARG] Returns [CComponent.res, TABLES.RES] DamagedReps [TABLES.ARG] SharedReps [CComponent.arg, CComponent.res]; CanonicaliseCorrespondenceList: TreeRecursiveFunction [Tree, CComponent.arg, TABLES.ARG] Returns [CComponent.res, TABLES.RES] DamagedReps [TABLES.ARG] SharedReps [CComponent.arg, CComponent.res]; CanonicaliseFieldList: TreeRecursiveFunction [Tree, CComponent.arg, TABLES.ARG] Returns [CComponent.res, TABLES.RES] DamagedReps [TABLES.ARG] SharedReps [CComponent.arg, CComponent.res]; CanonicaliseFieldsFromNameList: TreeRecursiveFunction [Tree, ROPE.arg, CComponent.arg, TABLES.ARG] Returns [CComponent.res, TABLES.RES] DamagedReps [TABLES.ARG] SharedReps [CComponent.arg, CComponent.res]; <> CanonicaliseType: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [ROPE, CType, TABLES.RES] DamagedReps [TABLES.ARG]; CheckAllNames: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CheckCorrespondenceList: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CheckIfErrorNames: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; Coerce: TreeRecursiveFunction [Tree, CType, ROPE, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CoerceComponentNameList: TreeRecursiveFunction [Tree, Constant, CComponent, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CoerceComponents: TreeRecursiveFunction [Tree, CComponent, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; CoerceElementList: TreeRecursiveFunction [Tree, CType, ROPE, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; ConstantToRope: TreeRecursiveFunction [Tree, ROPE.constantName, ROPE.constantType, FunctionList.functionList, ROPE.arg, TABLES.ARG] Returns [ROPE.res, FunctionList.res, TABLES.RES] DamagedReps [ROPE.arg, TABLES.ARG, FunctionList.functionList]; ConstructFunction: TreeRecursiveFunction [Tree, INT.ElementNo, ROPE.functionSoFar, ROPE.constantName, ROPE.constantType, FunctionList.constantFunctions, TABLES.ARG] Returns [ROPE.res, FunctionList.RES, TABLES.RES] DamagedReps [ROPE.functionSoFar, INT.ElementNo, FunctionList.constantFunctions, TABLES.ARG]; EmptyWorkTableOfNames: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; GetCARDINAL: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [CARD, TABLES.RES] DamagedReps [TABLES.ARG]; MakeSymbolTable: TreeRecursiveFunction [Tree] Returns [TABLES.RES]; NumberToCard: TreeRecursiveFunction [Tree] Returns [CARD]; NameListToRope: TreeRecursiveFunction [Tree, ROPE.arg, ROPE.const, TABLES.ARG] Returns [ROPE.res] DamagedReps [ROPE.arg]; ReadInTable: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; RecordNames: TreeRecursiveFunction [Tree, TABLES.ARG] Returns [TABLES.RES] DamagedReps [TABLES.ARG]; ReturnNodeClass: TreeRecursiveFunction [Tree] Returns [Generic]; Size: TreeRecursiveFunction [Tree, INT.arg] Returns [INT.res] DamagedReps [INT.arg]; --Gets Size of Element List TypeOfNameList: TreeRecursiveFunction [Tree, ROPE.constantType, TABLES] Returns [ROPE.typeOf]; End; AbstractProductions: Module = Begin <> Program: AbstractProduction [identifier, numberD.progno, numberD.verno, ReferencedProgramList, DeclarationList]; <> ReferencedProgramList.empty: AbstractProduction []; ReferencedProgramList.more: AbstractProduction [ReferencedProgramList, ReferencedProgram]; <> ReferencedProgram: AbstractProduction [identifier, numberD.progno, numberD.verno]; <> DeclarationList.empty: AbstractProduction []; DeclarationList.more: AbstractProduction [DeclarationList, Declaration]; <> Declaration.type: AbstractProduction [identifier, Type]; Declaration.constant: AbstractProduction [identifier, Type, Constant]; <> Type.array: AbstractProduction [Constant, Type]; Type.boolean: AbstractProduction []; Type.bulkDataSink: AbstractProduction []; Type.bulkDataSource: AbstractProduction []; Type.cardinal: AbstractProduction []; Type.choice: AbstractProduction [Type, CandidateList]; Type.emptyRecord: AbstractProduction []; Type.enumeration: AbstractProduction [CorrespondenceList]; Type.error: AbstractProduction [FieldList]; Type.integer: AbstractProduction []; Type.localReference: AbstractProduction [identifier]; Type.longCardinal: AbstractProduction []; Type.longInteger: AbstractProduction []; Type.procedure: AbstractProduction [FieldList.arg, FieldList.res, NameList]; Type.record: AbstractProduction [FieldList]; Type.remoteReference: AbstractProduction [identifier.a, identifier.b]; Type.sequence: AbstractProduction [Constant, Type]; Type.string: AbstractProduction []; Type.unspecified: AbstractProduction []; <> CorrespondenceList.one: AbstractProduction [identifier, Constant]; CorrespondenceList.more: AbstractProduction [CorrespondenceList.value, CorrespondenceList.next]; <> CandidateList.one: AbstractProduction [NameList, Type]; CandidateList.more: AbstractProduction [CandidateList.value, CandidateList.next]; <> FieldList.empty: AbstractProduction []; FieldList.one: AbstractProduction [NameList, Type]; FieldList.more: AbstractProduction [FieldList.value, FieldList.rest]; <> Constant.choice: AbstractProduction [identifier, Constant]; Constant.componentlist: AbstractProduction [ComponentList]; Constant.elementList: AbstractProduction [ElementList]; Constant.empty: AbstractProduction []; Constant.false: AbstractProduction []; Constant.id: AbstractProduction [identifier]; Constant.negativeNumber: AbstractProduction [number]; Constant.number: AbstractProduction [number]; Constant.remoteReference: AbstractProduction [identifier.left, identifier.right]; Constant.string: AbstractProduction [Rope]; Constant.true: AbstractProduction []; Constant.unbounded: AbstractProduction []; <> ElementList.one: AbstractProduction [Constant]; ElementList.more: AbstractProduction [Constant, ElementList]; <> ComponentList.one: AbstractProduction [Component]; ComponentList.more: AbstractProduction [Component, ComponentList]; <> Component: AbstractProduction [NameList, Constant]; <> NameList.empty: AbstractProduction []; NameList.one: AbstractProduction [identifier]; NameList.more: AbstractProduction [identifier, NameList]; <> number.decimal: AbstractProduction [numberD]; number.hex: AbstractProduction [numberH]; number.octal: AbstractProduction [numberO]; End; AbstractSyntax: Module = Begin <> for Program: AbstractProduction [identifier, numberD.progno, numberD.verno, ReferencedProgramList, DeclarationList] let MakeSymbolTable[tree] _ BuildTable[DeclarationList, tables2] where tables2 _ ReadInTable[ReferencedProgramList, tables1] where programKey _ CreateCanonicalKey[identifier, numberD.progno, numberD.verno] where tables1 _ RecordNames[DeclarationList, tables] where tables _ CreateTables[] ; <> for ReferencedProgramList.empty: AbstractProduction [] let ReadInTable[tree, tables] _ CopyTables[tables] ; for ReferencedProgramList.more: AbstractProduction [ReferencedProgramList, ReferencedProgram] let ReadInTable[tree, tables] _ ReadInTable[ReferencedProgram, tables1] where tables1 _ ReadInTable[ReferencedProgramList, tables] ; <> for ReferencedProgram: AbstractProduction [identifier, numberD.progno, numberD.verno] let ReadInTable[tree, tables] _ DiskToTable[tables, identifier, numberD.progno, numberD.verno] ; <> for DeclarationList.empty: AbstractProduction [] let BuildTable[tree, tables] _ CopyTables[tables] let RecordNames[tree, tables] _ CopyTables[tables] ; for DeclarationList.more: AbstractProduction [DeclarationList, Declaration] let BuildTable[tree, tables] _ tables2 where tables2 _ BuildTable[DeclarationList, tables1] where tables1 _ BuildTable[Declaration, tables] let RecordNames[tree, tables] _ RecordNames[DeclarationList, RecordNames[Declaration, tables]] ; <> for Declaration.type: AbstractProduction [identifier, Type] let BuildTable[tree, tables] _ tables1 where < canonicalType, typeTree, tables1 > _ CanonicaliseLocalReferenceType[identifier, tables] let RecordNames[tree, tables] _ IntoUnresolvedTypeTable[tables, CreateKey[identifier], Type] ; for Declaration.constant: AbstractProduction [identifier, Type, Constant] let BuildTable[tree, tables] _ tables1 where < canonicalType, constantTree, value, tables1 > _ GetConstantType[identifier, tables] let RecordNames[tree, tables] _ IntoUnresolvedConstantTable[tables, CreateKey[identifier], Type, Constant] ; <> <<>> for Type.array: AbstractProduction [Constant, Type] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType2, tables2 > where cType2 _ MkCType[Generic.array, int[bound], cComponent] where < bound, tables2 > _ GetCARDINAL[Constant, tables1] where cComponent _ MkCComponent["", 0, cName1, MkNILCComponent[]] where < cName1, cType1, tables1 > _ CanonicaliseType[Type, tables] <> ; for Type.boolean: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "BOOLEAN", MkCType[Generic.boolean, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.bulkDataSink: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "SINK", MkCType[Generic.bulkDataSink, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.bulkDataSource: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "SOURCE", MkCType[Generic.bulkDataSource, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.cardinal: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "CARDINAL", MkCType[Generic.cardinal, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.choice: AbstractProduction [Type, CandidateList] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType2, tables5 > where cType2 _ MkCType[Generic.choice, 0, cComponent2] where cComponent2 _ MkCComponent["", 0, cName1, cComponent1] -- the tag type where < cComponent1, tables5 > _ CanonicaliseCandidateList[CandidateList, MkNILCComponent[], cType1, tables3] <> where junk _ CheckIfEmpty[tables3] where tables3 _ EmptyWorkTableOfNames[CandidateList, tables2] where tables2 _ FillWorkTable[cType1, tables1] where match _ CompareClass[cType1, Generic.enumeration] where < cName1, cType1, tables1 > _ CanonicaliseType[Type, tables] ; for Type.emptyRecord: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType, CopyTables[tables] > where cType _ MkCType[Generic.record, 0, MkNILCComponent[]] ; for Type.enumeration: AbstractProduction [CorrespondenceList] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType, tables2 > where cType _ MkCType[Generic.enumeration, 0, cComponent] where < cComponent, tables2 > _ CanonicaliseCorrespondenceList[CorrespondenceList, MkNILCComponent[], tables1] where tables1 _ CheckCorrespondenceList[CorrespondenceList, ClearWorkTable[tables]] ; for Type.error: AbstractProduction [FieldList] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType, tables1 > where cType _ MkCType[Generic.error, 0, cComponent] where < cComponent, tables1 > _ CanonicaliseFieldList[FieldList, MkNILCComponent[], tables] ; for Type.integer: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "INTEGER", MkCType[Generic.integer, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.localReference: AbstractProduction [identifier] let CanonicaliseType[tree, tables] _ CanonicaliseLocalReferenceType[identifier, tables] ; for Type.longCardinal: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "LONGCARDINAL", MkCType[Generic.longCardinal, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.longInteger: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "LONGINTEGER", MkCType[Generic.longInteger, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.procedure: AbstractProduction [FieldList.arg, FieldList.res, NameList] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType, tables3 > where cType _ MkCType[Generic.procedure, nArgs, cComponent] where nArgs _ GetLengthOfCComponentList[cComponent, nResults] where < cComponent, tables3 > _ CanonicaliseFieldList[FieldList.arg, resultCComponent, tables2] where nResults _ GetLengthOfCComponentList[resultCComponent, 0] where okay _ CheckResultsForSourceAndSink[resultCComponent] where < resultCComponent, tables2 > _ CanonicaliseFieldList[FieldList.res, MkNILCComponent[], tables1] where tables1 _ CheckIfErrorNames[NameList, tables] ; for Type.record: AbstractProduction [FieldList] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType, tables1 > where cType _ MkCType[Generic.record, 0, cComponent] where < cComponent, tables1 > _ CanonicaliseFieldList[FieldList, MkNILCComponent[], tables] ; for Type.remoteReference: AbstractProduction [identifier.a, identifier.b] let CanonicaliseType[tree, tables] _ < canonicalName, cType, CopyTables[tables] > where cType _ FetchFromTypeTable[tables, canonicalName] where canonicalName _ ValueToRope[DirectoryEntry] <> where okay _ if successful then 0 else int[SendError["Undeclared Remote Identifier"]] where < successful, DirectoryEntry > _ Fetch[remoteDirectory, CreateKey[identifier.b]] where remoteDirectory _ FetchFromGlobalTable[tables, CreateKey[identifier.a]] ; for Type.sequence: AbstractProduction [Constant, Type] let CanonicaliseType[tree, tables] _ < "DEFAULT", cType2, tables2 > where cType2 _ MkCType[Generic.sequence, int[bound], cComponent] where < bound, tables2 > _ GetCARDINAL[Constant, tables1] where cComponent _ MkCComponent["", 0, cName1, MkNILCComponent[]] where < cName1, cType1, tables1 > _ CanonicaliseType[Type, tables] <> ; for Type.string: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "STRING", MkCType[Generic.string, 0, MkNILCComponent[]], CopyTables[tables] > ; for Type.unspecified: AbstractProduction [] let CanonicaliseType[tree, tables] _ < "UNSPECIFIED", MkCType[Generic.unspecified, 0, MkNILCComponent[]], CopyTables[tables] > ; <> for CorrespondenceList.one: AbstractProduction [identifier, Constant] let CanonicaliseCorrespondenceList[tree, cComponentArg, tables] _ < cComponent, tables1 > where cComponent _ MkCComponent[CreateKey[identifier], int[value], "", cComponentArg] where < value, tables1 > _ GetCARDINAL[Constant, tables] <> let CheckCorrespondenceList[tree, tables] _ SeeIfDuplicated[tables1, identifier, value] where < value, tables1 > _ GetCARDINAL[Constant, tables] ; for CorrespondenceList.more: AbstractProduction [CorrespondenceList.value, CorrespondenceList.next] <> let CanonicaliseCorrespondenceList[tree, cComponentArg, tables] _ CanonicaliseCorrespondenceList[CorrespondenceList.value, cComponent1, tables1] where < cComponent1, tables1 > _ CanonicaliseCorrespondenceList[CorrespondenceList.next, cComponentArg, tables] let CheckCorrespondenceList[tree, tables] _ CheckCorrespondenceList[CorrespondenceList.next, CheckCorrespondenceList[CorrespondenceList.value, tables]] ; <> for CandidateList.one: AbstractProduction [NameList, Type] let CanonicaliseCandidateList[tree, cComponentArg, cTypeTag, tables] _ CanonicaliseFieldsFromNameList[NameList, variantCName, cComponentArg, tables1] <> <<& all members of enumeration are listed>> <> where < variantCName, variantCType, tables1 > _ CanonicaliseType[Type, tables] let EmptyWorkTableOfNames[tree, tables] _ EmptyWorkTableOfNames[NameList, tables] ; for CandidateList.more: AbstractProduction [CandidateList.value, CandidateList.next] <> let CanonicaliseCandidateList[tree, cComponentArg, cTypeTag, tables] _ CanonicaliseCandidateList[CandidateList.value, cComponent1, cTypeTag, tables1] where < cComponent1, tables1 > _ CanonicaliseCandidateList[CandidateList.next, cComponentArg, cTypeTag, tables] let EmptyWorkTableOfNames[tree, tables] _ EmptyWorkTableOfNames[CandidateList.next, EmptyWorkTableOfNames[CandidateList.value, tables]] ; <> for FieldList.empty: AbstractProduction [] let CanonicaliseFieldList[tree, CComponentArg, tables] _ < CopyCComponent[CComponentArg], CopyTables[tables] > ; for FieldList.one: AbstractProduction [NameList, Type] let CanonicaliseFieldList[tree, cComponentArg, tables] _ CanonicaliseFieldsFromNameList[NameList, cName, cComponentArg, tables1] where < cName, cType, tables1 > _ CanonicaliseType[Type, tables] ; for FieldList.more: AbstractProduction [FieldList.value, FieldList.rest] <> let CanonicaliseFieldList[tree, CComponentArg, tables] _ CanonicaliseFieldList[FieldList.value, cComponent1, tables1] where < cComponent1, tables1 > _ CanonicaliseFieldList[FieldList.rest, CComponentArg, tables] ; <> <<>> for Constant.choice: AbstractProduction [identifier, Constant] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Choice"], CopyTables[tables] > let Coerce[tree, typeCtype, typeTypeName, tables] _ Coerce[Constant, cType, ctypeName, tables] where < cType, ctypeName > _ GetCType[identifier, cComponent, tables] where cComponent _ GetCTypeFirstChild[typeCtype] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ CopyAll[Concat[rope2, "]]"], constantFunctions1, tables1] where < rope2, constantFunctions1, tables1 > _ ConstantToRope[Constant, constantName, constantType1, constantFunctions, rope1, tables] where constantType1 _ GetTypeOfComponent[identifier, constantType, tables] where rope1 _ Concat[constantValue, Cat["[", CreateKey[identifier], "["]] ; for Constant.componentlist: AbstractProduction [ComponentList] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Record"], CopyTables[tables] > let Coerce[tree, typeCtype, typeTypeName, tables] _ CoerceComponents[ComponentList, cComponent, tables2] < CheckAllNames[ComponentList, typeCtype, tables]; - Done>> where junk _ CheckIfEmpty[tables2] where tables2 _ CheckAllNames[ComponentList, tables1] where tables1 _ EnterNamesIntoWorkTable[typeCtype, tables] where cComponent _ CompareClass[typeCtype, Generic.record] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ CopyAll[Concat[rope2, "]"], constantFunctions1, tables1] where < rope2, constantFunctions1, tables1 > _ ConstantToRope[ComponentList, constantName, constantType, constantFunctions, rope1, tables] where rope1 _ Concat["[", constantValue] ; for Constant.elementList: AbstractProduction [ElementList] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found ElementList"], CopyTables[tables] > let Coerce[tree, typeCtype, typeTypeName, tables] _ CoerceElementList[ElementList, cType, cName, tables] where < cType, cName > _ SeeIfArrOrSeq[typeCtype, numberOfElementInList, tables] where numberOfElementInList _ Size[ElementList, 0] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ CopyAll[Concat[rope2, "]"], constantFunctions3, tables3] where < rope2, constantFunctions3, tables3 > _ if Array[constantType, tables] then < ConstantToRope[ElementList, constantName, constantType, constantFunctions, rope1, tables] where rope1 _ Concat[constantValue, "["] > else < CopyAll[rope1, constantFunctions1, tables1] where rope1 _ Cat[constantValue, functionName, "["] where tables1 _ IntoCondensedFunctionTable[functionName, function, tables2] where function _ Nest[Cat[functionBody, "};", ""], nat[1]] where < functionBody, constantFunctions1, tables2 > _ ConstructFunction[ElementList, 0, functionHeader, constantName, TypeOfElements, constantFunctions2, tables] where TypeOfElements _ TypeOfSequence[constantType, tables] where functionHeader _ NewFcn[functionName, ObjectName, Size[ElementList, 0]] where ObjectName _ GetObjectName[constantType, tables] where constantFunctions2 _ ConsFunctionList[constantFunctions, functionName] where functionName _ MakeUpFunctionName[] > ; for Constant.empty: AbstractProduction [] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Empty ElementList"], CopyTables[tables] > let Coerce[tree, typeCtype, typeTypeName, tables] _ tables1 where junk _ CheckIfEmpty[tables1] where tables1 _ EnterNamesIntoWorkTable[typeCtype, tables] where cComponent _ CompareClass[typeCtype, Generic.record] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, "NULL"], CopyFunctionList[constantFunctions], CopyTables[tables]] ; for Constant.false: AbstractProduction [] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Boolean"], CopyTables[tables] > let Coerce[tree, type, typeTypeName, tables] _ CheckCanonicalType[typeTypeName, "BOOLEAN", tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, "FALSE"], CopyFunctionList[constantFunctions], CopyTables[tables]] ; for Constant.id: AbstractProduction [identifier] let GetCARDINAL[tree, tables] _ GetCARDINAL[value, tables1] where < constantType, constantTree, value, tables1 > _ GetConstantType[identifier, tables] let Coerce[tree, typeCtype, typeTypeName, tables] _ tables1 where match _ if Equal[typeTypeName, constantTypeName] then 0 else CompareTypes[typeCtype, ConstantCType, tables1] where < constantTypeName, ConstantCType, value, tables1 > _ if NotEnumeration[typeCtype] then GetConstantType[identifier, tables] else < Copy[typeTypeName, typeCtype, tree, tables] where junk _ IsEnumerationConstant[typeCtype, identifier] > let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ AddLocalConstantToRope[identifier, constantName, constantType, constantFunctions, invalue, tables] <> <> ; for Constant.negativeNumber: AbstractProduction [number] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Negative Number"], CopyTables[tables] > let Coerce[tree, ctype, typeName, tables] _ tables1 where okay _ TryToCoerceNumber[ctype, value] where < value, tables1 > _ GetCARDINAL[number, tables] where junk _ SeeIfInt[ctype] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, addedValue], CopyFunctionList[constantFunctions], CopyTables[tables]] where addedValue _ Concat["-", RopeFromCard[NumberToCard[number]]] ; for Constant.number: AbstractProduction [number] let GetCARDINAL[tree, tables] _ GetCARDINAL[number, tables] let Coerce[tree, ctype, typeName, tables] _ tables1 where okay _ TryToCoerceNumber[ctype, value] where < value, tables1 > _ GetCARDINAL[number, tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, addedValue], CopyFunctionList[constantFunctions], CopyTables[tables]] where addedValue _ RopeFromCard[NumberToCard[number]] ; for Constant.remoteReference: AbstractProduction [identifier.left, identifier.right] let GetCARDINAL[tree, tables] _ GetCARDINAL[value, tables] where value _ ValueToConstant[DirectoryEntry] where constantType _ ValueToRope[DirectoryEntry] where okay _ if successful then 0 else int[SendError["Undeclared Remote Identifier"]] where < successful, DirectoryEntry > _ Fetch[remoteDirectory, CreateKey[identifier.right]] where remoteDirectory _ FetchFromGlobalTable[tables, CreateKey[identifier.left]] let Coerce[tree, typeCtype, typeTypeName, tables] _ CopyTables[tables] where match _ if Equal[typeTypeName, constantTypeName] then 0 else CompareTypes[ConstantCType, typeCtype, tables] where value _ ValueToConstant[DirectoryEntry] where ConstantCType _ FetchFromTypeTable[tables, constantTypeName] where constantTypeName _ ValueToRope[DirectoryEntry] where < successful2, DirectoryEntry > _ Fetch[remoteDirectory, CreateKey[identifier.right]] where remoteDirectory _ FetchFromGlobalTable[tables, CreateKey[identifier.left]] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[ValueToRopeConstant[DirectoryEntry, invalue], constantFunctions1, tables1] <> where constantFunctions1 _ AddFunctionList[DirectoryEntry, constantFunctions] <> where tables1 _ AddFunctionToTable[DirectoryEntry, constantFunctions, tables] where < successful2, DirectoryEntry > _ Fetch[remoteDirectory, CreateKey[identifier.right]] where remoteDirectory _ FetchFromGlobalTable[tables, CreateKey[identifier.left]] ; for Constant.string: AbstractProduction [Rope] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found String"], CopyTables[tables] > let Coerce[tree, type, canonicalType, tables] _ CheckCanonicalType[canonicalType, "STRING", tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, RopeTokenToROPE[Rope]], CopyFunctionList[constantFunctions], CopyTables[tables]] ; for Constant.true: AbstractProduction [] let GetCARDINAL[tree, tables] _ < SendError["Expected CARDINAL found Boolean"], CopyTables[tables] > let Coerce[tree, type, typeTypeName, tables] _ CheckCanonicalType[typeTypeName, "BOOLEAN", tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, "TRUE"], CopyFunctionList[constantFunctions], CopyTables[tables]] ; for Constant.unbounded: AbstractProduction [] let GetCARDINAL[tree, tables] _ < card[65536], CopyTables[tables] > let Coerce[tree, type, canonicalType, tables] _ CheckCanonicalType[canonicalType, "UNBOUNDED", tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, invalue, tables] _ CopyAll[Concat[invalue, "65536"], CopyFunctionList[constantFunctions], CopyTables[tables]] ; <> <<>> for ElementList.one: AbstractProduction [Constant] let CoerceElementList[tree, cType, ctypeName, tables] _ Coerce[Constant, cType, ctypeName, tables] let Size[tree, numberOfElementInList] _ AddOne[numberOfElementInList] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ ConstantToRope[Constant, constantName, constantType, constantFunctions, constantValue, tables] let ConstructFunction[tree, ElementNo, functionSoFar, constantName, constantType, constantFunctions, tables] _ CopyAll[Cat[functionSoFar, variable, value], constantFunctions1, tables1] where value _ Concat[value1, ";\n"] where < value1, constantFunctions1, tables1 > _ ConstantToRope[Constant, constantName, constantType, constantFunctions, "", tables] where variable _ Cat["temp[", RopeFromInt[ElementNo], "] _"] ; for ElementList.more: AbstractProduction [Constant, ElementList] let CoerceElementList[tree, cType, ctypeName, tables] _ CoerceElementList[ElementList, cType, ctypeName, tables1] where tables1 _ Coerce[Constant, cType, ctypeName, tables] let Size[tree, numberOfElementInList] _ Size[ElementList, AddOne[numberOfElementInList]] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ ConstantToRope[ElementList, constantName, constantType, constantFunctions1, rope2, tables1] where rope2 _ Concat[rope1, ", "] where < rope1, constantFunctions1, tables1 > _ ConstantToRope[Constant, constantName, constantType, constantFunctions, constantValue, tables] let ConstructFunction[tree, ElementNo, functionSoFar, constantName, TypeOfElement, constantFunctions, tables] _ ConstructFunction[ElementList, AddOne[ElementNo], functionSoFar1, constantName, TypeOfElement, constantFunctions1, tables1] where functionSoFar1 _ Cat[functionSoFar, variable, value] where value _ Concat[value1, ";\n"] where < value1, constantFunctions1, tables1 > _ ConstantToRope[Constant, constantName, TypeOfElement, constantFunctions, "", tables] where variable _ Cat["temp[", RopeFromInt[ElementNo], "] _"] ; <<>> <> <<>> for ComponentList.one: AbstractProduction [Component] let CoerceComponents[tree, cComponent, tables] _ CoerceComponents[Component, cComponent, tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ ConstantToRope[Component, constantName, constantType, constantFunctions, constantValue, tables] let CheckAllNames[tree, tables] _ CheckAllNames[Component, tables] ; for ComponentList.more: AbstractProduction [Component, ComponentList] let CoerceComponents[tree, cComponent, tables] _ CoerceComponents[ComponentList, cComponent, tables1] where tables1 _ CoerceComponents[Component, cComponent, tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ ConstantToRope[ComponentList, constantName, constantType, constantFunctions1, rope1, tables1] where rope1 _ Concat[rope2, ", "] where < rope2, constantFunctions1, tables1 > _ ConstantToRope[Component, constantName, constantType, constantFunctions, constantValue, tables] let CheckAllNames[tree, tables] _ CheckAllNames[ComponentList, CheckAllNames[Component, tables]] ; <<>> <> <<>> for Component: AbstractProduction [NameList, Constant] let CoerceComponents[tree, cComponent, tables] _ CoerceComponentNameList[NameList, Constant, cComponent, tables] let ConstantToRope[tree, constantName, constantType, constantFunctions, constantValue, tables] _ CopyAll[NameListToRope[NameList, constantValue, rope0, tables1], constantFunctions1, tables1] where < rope0, constantFunctions1, tables1 > _ ConstantToRope[Constant, constantName, constantType1, constantFunctions, "", tables] where constantType1 _ TypeOfNameList[NameList, constantType, tables] let CheckAllNames[tree, tables] _ EmptyWorkTableOfNames[NameList, tables] ; <<>> <> for NameList.empty: AbstractProduction [] let CheckIfErrorNames[tree, tables] _ CopyTables[tables] let CanonicaliseFieldsFromNameList[tree, cName, cComponentArg, tables] _ < MkNILCComponent[], CopyTables[tables] > let CoerceComponentNameList[tree, constant, cComponent, tables] _ CopyTables[tables] let NameListToRope[tree, invalue, constantRope, tables] _ CopyRope[invalue] let EmptyWorkTableOfNames[tree, tables] _ CopyTables[tables] let TypeOfNameList[tree, constantType, tables] _ CopyRope[constantType] -- Should Yield Error ; for NameList.one: AbstractProduction [identifier] let CheckIfErrorNames[tree, tables] _ InsureErrorType[identifier, tables] let CanonicaliseFieldsFromNameList[tree, cName, cComponentArg, tables] _ < cComponentres, CopyTables[tables] > where cComponentres _ MkCComponent[CreateKey[identifier], 0, cName, cComponentArg] let CoerceComponentNameList[tree, constant, cComponent, tables] _ Coerce[constant, cType, ctypeName, tables] where < cType, ctypeName > _ GetCType[identifier, cComponent, tables] let NameListToRope[tree, invalue, constantRope, tables] _ Cat[rope1, ": ", constantRope] where rope1 _ Concat[invalue, CreateKey[identifier]] let EmptyWorkTableOfNames[tree, tables] _ Remove[identifier, tables] let TypeOfNameList[tree, constantType, tables] _ GetTypeOfComponent[identifier, constantType, tables] ; for NameList.more: AbstractProduction [identifier, NameList] let CheckIfErrorNames[tree, tables] _ CheckIfErrorNames[NameList, tables1] where tables1 _ InsureErrorType[identifier, tables] let CanonicaliseFieldsFromNameList[tree, cName, cComponentArg, tables] _ < cComponentres, CopyTables[tables1] > where cComponentres _ MkCComponent[CreateKey[identifier], 0, cName, cComponent1] where < cComponent1, tables1 > _ CanonicaliseFieldsFromNameList[NameList, cName, cComponentArg, tables] let CoerceComponentNameList[tree, constant, cComponent, tables] _ tables2 where tables2 _ CoerceComponentNameList[NameList, constant, cComponent, tables1] where tables1 _ Coerce[constant, cType, ctypeName, tables] where < cType, ctypeName > _ GetCType[identifier, cComponent, tables] let NameListToRope[tree, invalue, constantRope, tables] _ NameListToRope[NameList, rope3, constantRope, tables] where rope3 _ Concat[rope2, ", "] where rope2 _ Cat[rope1, ": ", constantRope] where rope1 _ Concat[invalue, CreateKey[identifier]] let EmptyWorkTableOfNames[tree, tables] _ EmptyWorkTableOfNames[NameList, Remove[identifier, tables]] let TypeOfNameList[tree, constantType, tables] _ GetTypeOfComponent[identifier, constantType, tables] ; <> <<>> for number.decimal: AbstractProduction [numberD] let GetCARDINAL[tree, tables] _ < GetCardFromDecimal[numberD], CopyTables[tables] > let NumberToCard[tree] _ GetCardFromDecimal[numberD] ; for number.hex: AbstractProduction [numberH] let GetCARDINAL[tree, tables] _ < GetCardFromHex[numberH], CopyTables[tables] > let NumberToCard[tree] _ GetCardFromHex[numberH] ; for number.octal: AbstractProduction [numberO] let GetCARDINAL[tree, tables] _ < GetCardFromOctal[numberO], CopyTables[tables] > let NumberToCard[tree] _ GetCardFromOctal[numberO] ; End; ConcreteSyntax: Module = Begin <> { "ARRAY" "BEGIN" "BOOLEAN" "CARDINAL" "CHOICE" "DEPENDS" "END" "ERROR" "FALSE" "INTEGER" "LONG" "OF" "PROCEDURE" "PROGRAM" "RECORD" "REPORTS" "RETURNS" "SEQUENCE" "SINK" "SOURCE" "STRING" "TRUE" "TYPE" "UNSPECIFIED" "UPON" "VERSION" }: SimpleTokens; { "(" ")" "[" "]" "{" "}" ":" "." ";" "=" "=>" "," "-" }: SimpleTokens; <> OuterProgram: NonTerminal Builds Program; for OuterProgram _ Program "." Build Program; Program: NonTerminal Builds Program; for Program _ identifier ":" "PROGRAM" numberD.a "VERSION" numberD.b "=" "BEGIN" DependencyList DeclarationList "END" Build Program[identifier, numberD.a, numberD.b, DependencyList, DeclarationList]; DependencyList: NonTerminal Builds ReferencedProgramList; for DependencyList.empty _ Build ReferencedProgramList.empty[]; for DependencyList.more_ "DEPENDS" "UPON" ReferencedProgramList ";" Build ReferencedProgramList; ReferencedProgramList: NonTerminal Builds ReferencedProgramList; for ReferencedProgramList.one _ ReferencedProgram Build ReferencedProgramList.more[ReferencedProgramList.empty[[ReferencedProgram, ReferencedProgram)], ReferencedProgram]; for ReferencedProgramList.more _ ReferencedProgramList "," ReferencedProgram Build ReferencedProgramList.more[ReferencedProgramList, ReferencedProgram]; ReferencedProgram: NonTerminal Builds ReferencedProgram; for ReferencedProgram _ identifier "(" numberD.a ")" "VERSION" numberD.b Build ReferencedProgram[identifier, numberD.a, numberD.b]; DeclarationList: NonTerminal Builds DeclarationList; for DeclarationList.a _ Build DeclarationList.empty[]; for DeclarationList .b_ DeclarationList Declaration Build DeclarationList.more[DeclarationList, Declaration]; Declaration: NonTerminal Builds Declaration; for Declaration.type _ identifier ":" "TYPE" "=" Type";" Build Declaration.type[identifier, Type]; for Declaration.constant _ identifier ":" Type "=" Constant ";" Build Declaration.constant[identifier, Type, Constant]; for Declaration.id _ identifier.name ":" Type "=" identifier.constant ";" Build Declaration.constant[identifier.name, Type, Constant.id[identifier.constant]]; <> Type: NonTerminal Builds Type; for Type.simple _ SimpleType Build SimpleType; for Type.ConstructedType _ ConstructedType Build ConstructedType; SimpleType: NonTerminal Builds Type; for SimpleType.predefinedType _ PredefinedType Build PredefinedType; for SimpleType.referencedType _ ReferencedType Build ReferencedType; PredefinedType: NonTerminal Builds Type; for PredefinedType.boolean _ "BOOLEAN" Build Type.boolean[]; for PredefinedType.Cardinal _ "CARDINAL" Build Type.cardinal[]; for PredefinedType.longCardinal _ "LONG" "CARDINAL" Build Type.longCardinal[]; for PredefinedType.integer_ "INTEGER" Build Type.integer[]; for PredefinedType.longInteger _ "LONG" "INTEGER" Build Type.longInteger[]; for PredefinedType.string _ "STRING" Build Type.string[]; for PredefinedType.unspecified _ "UNSPECIFIED" Build Type.unspecified[]; for PredefinedType.bulkDataSource _ "SOURCE" Build Type.bulkDataSource[]; for PredefinedType.bulkDataSink _ "SINK" Build Type.bulkDataSink[]; ConstructedType: NonTerminal Builds Type; for ConstructedType.enumeration _ "{" CorrespondenceList "}" Build Type.enumeration[CorrespondenceList]; for ConstructedType.array _ "ARRAY" MandatoryNumber "OF" SimpleType Build Type.array[MandatoryNumber, SimpleType]; for ConstructedType.sequence _ "SEQUENCE" OptionalNumber "OF" SimpleType Build Type.sequence[OptionalNumber, SimpleType]; --Can be empty for ConstructedType.record _ "RECORD" "[" FieldList"]" Build Type.record[FieldList]; for ConstructedType.emptyRecord _ "RECORD" "[" "]" Build Type.emptyRecord[]; for ConstructedType.choice _ "CHOICE" ReferencedType "OF" "{" CandidateList "}" Build Type.choice[ReferencedType, CandidateList]; for ConstructedType.procedure _ "PROCEDURE" ArgumentList ResultList ErrorList Build Type.procedure[ArgumentList, ResultList, ErrorList]; for ConstructedType.error _ "ERROR" ArgumentList Build Type.error[ArgumentList]; ReferencedType: NonTerminal Builds Type; for ReferencedType.localReference _ identifier Build Type.localReference[identifier]; for ReferencedType.remoteReference _ identifier.remote "." identifier.id Build Type.remoteReference[identifier.remote, identifier.id]; CorrespondenceList: NonTerminal Builds CorrespondenceList; for CorrespondenceList.one _ Correspondence Build Correspondence; for CorrespondenceList.more _ Correspondence "," CorrespondenceList Build CorrespondenceList.more[Correspondence, CorrespondenceList]; Correspondence: NonTerminal Builds CorrespondenceList; for Correspondence _ identifier "(" MandatoryNumber ")" Build CorrespondenceList.one[identifier, MandatoryNumber]; OptionalNumber: NonTerminal Builds Constant; for OptionalNumber.nonEmpty _ Constant Build Constant; for OptionalNumber.localReference _ identifier Build Constant.id[identifier]; for OptionalNumber.empty _ Build Constant.unbounded[]; MandatoryNumber: NonTerminal Builds Constant; for MandatoryNumber.value _ Constant Build Constant; for MandatoryNumber.localReference _ identifier Build Constant.id[identifier]; CandidateList: NonTerminal Builds CandidateList; for CandidateList.one _ Candidate Build Candidate; for CandidateList.more _ Candidate "," CandidateList Build CandidateList.more[Candidate, CandidateList]; Candidate: NonTerminal Builds CandidateList; for Candidate.one _ NameList "=>" SimpleType Build CandidateList.one[NameList, SimpleType]; for Candidate.two _ NameList "(" number ")" "=>" SimpleType Build CandidateList.one[NameList, SimpleType]; ArgumentList: NonTerminal Builds FieldList; for ArgumentList.a _ Build FieldList.empty[]; for ArgumentList.b _ "[" FieldList "]" Build FieldList; for ArgumentList.c _ "[" "]" Build FieldList.empty[]; ResultList: NonTerminal Builds FieldList; for ResultList.a _ Build FieldList.empty[]; for ResultList.b _ "RETURNS" "[" FieldList "]" Build FieldList; for ResultList.c _ "RETURNS" "[" "]" Build FieldList.empty[]; ErrorList: NonTerminal Builds NameList; for ErrorList.a _ Build NameList.empty[]; for ErrorList.b _ "REPORTS" "[" NameList "]" Build NameList; FieldList: NonTerminal Builds FieldList; for FieldList.a _ Field Build FieldList.more[Field, FieldList.empty[[Field, Field)]]; for FieldList.b _ Field "," FieldList Build FieldList.more[Field, FieldList]; Field: NonTerminal Builds FieldList; for Field _ NameList ":" SimpleType Build FieldList.one[NameList, SimpleType]; <> <<>> Constant: NonTerminal Builds Constant; for Constant.predefined _ PredefinedConstant Build PredefinedConstant; for Constant.constructed _ ConstructedConstant Build ConstructedConstant; for Constant.choiceConstant _ identifier Constant Build Constant.choice[identifier, Constant]; for Constant.choiceIdentifier _ identifier.first identifier.next Build Constant.choice[identifier.first, Constant.id[identifier.next]]; for Constant.remoteReference _ identifier.left "." identifier.right Build Constant.remoteReference[identifier.left, identifier.right]; <> PredefinedConstant: NonTerminal Builds Constant; for PredefinedConstant.true _ "TRUE" Build Constant.true[]; for PredefinedConstant.false _ "FALSE" Build Constant.false[]; for PredefinedConstant.number _ number Build Constant.number[number]; for PredefinedConstant.negativeNumber _ "-" number Build Constant.negativeNumber[number]; for PredefinedConstant.string _ Rope Build Constant.string[Rope]; ConstructedConstant: NonTerminal Builds Constant; for ConstructedConstant.elementList _ "[" ElementList "]" Build Constant.elementList[ElementList]; for ConstructedConstant.componentlist _ "[" ComponentList "]" Build Constant.componentlist[ComponentList]; for ConstructedConstant.empty _ "[" "]" Build Constant.empty[]; ElementList: NonTerminal Builds ElementList; for ElementList.one _ Constant Build ElementList.one[Constant]; for ElementList.more _ Constant "," ElementList Build ElementList.more[Constant, ElementList]; for ElementList.id _ identifier Build ElementList.one[Constant.id[identifier]]; for ElementList.idAndMore _ identifier "," ElementList Build ElementList.more[Constant.id[identifier], ElementList]; ComponentList: NonTerminal Builds ComponentList; for ComponentList.one _ Component Build ComponentList.one[Component]; for ComponentList.more _ Component "," ComponentList Build ComponentList.more[Component, ComponentList]; Component: NonTerminal Builds Component; for Component.more _ NameList ":" Constant Build Component[NameList, Constant]; for Component.one _ NameList ":" identifier Build Component[NameList, Constant.id[identifier]]; NameList: NonTerminal Builds NameList; for NameList.one _ identifier Build NameList.one[identifier]; for NameList.more _ identifier "," NameList Build NameList.more[identifier, NameList]; number: NonTerminal Builds number; for number.a _ numberD Build number.decimal[numberD]; for number.b _ numberO Build number.octal[numberO]; for number.c _ numberH Build number.hex[numberH] End.