DIRECTORY ThreeC4BaseDecl1Def, Rope, ThreeC4Support, ThreeC4CProdAbGramDef, ThreeC4BaseDecl2Def, ThreeC4BasicAbTypesDef; ThreeC4CProdImplImpl: CEDAR PROGRAM IMPORTS ThreeC4BaseDecl1Def, ThreeC4Support, ThreeC4CProdAbGramDef, ThreeC4BaseDecl2Def EXPORTS ThreeC4CProdAbGramDef= BEGIN OPEN ThreeC4BaseDecl1Def, Rope, ThreeC4Support, ThreeC4CProdAbGramDef, ThreeC4BaseDecl2Def, ThreeC4BasicAbTypesDef; ConcreteProductionProdTestLinkPresent: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: BOOLEAN] = BEGIN tree: ConcreteProductionNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteProductionProdData ← NARROW[tree.data]; temp0 ← EqualRopes["True", "True"]; END END; ConcreteProductionProdSyntaxFileCodes: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: MesaCodeNode, temp1: MesaCodeNode] = BEGIN tree: ConcreteProductionNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteProductionProdData ← NARROW[tree.data]; BEGIN prod: MesaCodeNode; prod ← RopeCode2["%g ← %g;\N", DotedNameFill[treeData.ModId.procs.FormName[treeData.ModId]], CodeFill[treeData.ConcreteRightSideList.procs.SyntaxRightSideFileCode[treeData.ConcreteRightSideList]]]; temp1 ← prod; temp0 ← BuildEmptyCode[]; END; END END; ConcreteProductionProdLinkFileCode: PUBLIC PROC[ref: REF ANY, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: ConcreteProductionNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteProductionProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; index: INT; prodName: NameNode; prodName ← treeData.ModId.procs.FormName[treeData.ModId]; index ← LookUpProduction[context, prodName]; code ← RopeCode2["prodLinkArray[%g] ← See%g;\N", IntFill[index], NameFill[prodName]]; temp1 ← FakeUsageCopy[usage]; temp0 ← code; END; END END; ConcreteProductionProdImplFileCode: PUBLIC PROC[ref: REF ANY, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: ConcreteProductionNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteProductionProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; headCode: MesaCodeNode; nodeVarDeclCode: MesaCodeNode; nodeVarAssignCode: MesaCodeNode; bodyCode: MesaCodeNode; returnCode: MesaCodeNode; endCode: MesaCodeNode; use: UsageNode; check: BOOLEAN; expCode: MesaCodeNode; expType: TypeNode; use1: UsageNode; context1: LookupContextNode; subNodeNames: NameListNode; subNodeTypes: TypeListNode; prodName: NameNode; prodBuildType: TypeNode; False: BOOLEAN; False ← EqualRopes["False", "True"]; prodBuildType ← LookUpGrammarSymbol[context, BuildName[treeData.ModId.procs.FormFirstId[treeData.ModId]]]; prodName ← treeData.ModId.procs.FormName[treeData.ModId]; subNodeTypes ← treeData.ConcreteRightSideList.procs.FormTypeList[treeData.ConcreteRightSideList, context]; subNodeNames ← treeData.ConcreteRightSideList.procs.FormNameList[treeData.ConcreteRightSideList]; context1 ← treeData.ConcreteRightSideList.procs.FormRightSideContext[treeData.ConcreteRightSideList, context]; [expCode, expType, use1] ← treeData.BuildExp.procs.FormBuildExpCode[treeData.BuildExp, False, context1, usage]; check ← CompareValTypeWithVarType[expType, prodBuildType]; use ← RecordTypesUse[use1, subNodeTypes]; endCode ← RopeCode["END;\N\N"]; returnCode ← RopeCode["RETURN[stack]\N"]; bodyCode ← RopeCode1["stack ← CONS[%g, stack];\N", CodeFill[expCode]]; nodeVarAssignCode ← treeData.ConcreteRightSideList.procs.FormNodeVarAssignCode[treeData.ConcreteRightSideList]; nodeVarDeclCode ← BuildVarDeclCode[subNodeNames, subNodeTypes]; headCode ← ConcatCode4[RopeCode1["See%g: PROC[nodes: LIST OF REF ANY, position: INT, length: INT]\N", NameFill[prodName]], RopeCode["\TRETURNS[LIST OF REF ANY] =\N"], RopeCode["BEGIN\N"], RopeCode["stack: LIST OF REF ANY ← nodes;\N"]]; code ← ConcatCode6[headCode, nodeVarDeclCode, nodeVarAssignCode, bodyCode, returnCode, endCode]; temp1 ← use; temp0 ← code; END; END END; ConcreteProductionProdCollectProductions: PUBLIC PROC[ref: REF ANY, first: INT, context: ContextNode] RETURNS[temp0: INT, temp1: ContextNode] = BEGIN tree: ConcreteProductionNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteProductionProdData ← NARROW[tree.data]; temp1 ← RecordProduction[context, treeData.ModId.procs.FormName[treeData.ModId], first]; temp0 ← Add1ToInt[first]; END END; ConcreteRightSideListemptyProdSyntaxRightSideFileCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 ← BuildEmptyCode[]; END END; ConcreteRightSideListemptyProdFormNodeVarAssignCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 ← BuildEmptyCode[]; END END; ConcreteRightSideListemptyProdFormTypeList: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: TypeListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 ← BuildEmptyTypeList[]; END END; ConcreteRightSideListemptyProdFormNameList: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: NameListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 ← BuildEmptyNameList[]; END END; ConcreteRightSideListemptyProdFormRightSideContext: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: LookupContextNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 ← context; END END; ConcreteRightSideListoneProdSyntaxRightSideFileCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListoneProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.SyntaxRightSideFileCode[treeData.ConcreteRightSideItem]; END END; ConcreteRightSideListoneProdFormNodeVarAssignCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListoneProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.FormNodeVarAssignCode[treeData.ConcreteRightSideItem]; END END; ConcreteRightSideListoneProdFormTypeList: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: TypeListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListoneProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.FormTypeList[treeData.ConcreteRightSideItem, context]; END END; ConcreteRightSideListoneProdFormNameList: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: NameListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListoneProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.FormNameList[treeData.ConcreteRightSideItem]; END END; ConcreteRightSideListoneProdFormRightSideContext: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: LookupContextNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListoneProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.FormRightSideContext[treeData.ConcreteRightSideItem, context]; END END; ConcreteRightSideListmanyProdSyntaxRightSideFileCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListmanyProdData ← NARROW[tree.data]; temp0 ← ConcatCode2[treeData.ConcreteRightSideList.procs.SyntaxRightSideFileCode[treeData.ConcreteRightSideList], treeData.ConcreteRightSideItem.procs.SyntaxRightSideFileCode[treeData.ConcreteRightSideItem]]; END END; ConcreteRightSideListmanyProdFormNodeVarAssignCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListmanyProdData ← NARROW[tree.data]; temp0 ← ConcatCode2[treeData.ConcreteRightSideItem.procs.FormNodeVarAssignCode[treeData.ConcreteRightSideItem], treeData.ConcreteRightSideList.procs.FormNodeVarAssignCode[treeData.ConcreteRightSideList]]; END END; ConcreteRightSideListmanyProdFormTypeList: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: TypeListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListmanyProdData ← NARROW[tree.data]; temp0 ← ConcatTypeLists[treeData.ConcreteRightSideList.procs.FormTypeList[treeData.ConcreteRightSideList, context], treeData.ConcreteRightSideItem.procs.FormTypeList[treeData.ConcreteRightSideItem, context]]; END END; ConcreteRightSideListmanyProdFormNameList: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: NameListNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListmanyProdData ← NARROW[tree.data]; temp0 ← ConcatNameLists[treeData.ConcreteRightSideList.procs.FormNameList[treeData.ConcreteRightSideList], treeData.ConcreteRightSideItem.procs.FormNameList[treeData.ConcreteRightSideItem]]; END END; ConcreteRightSideListmanyProdFormRightSideContext: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: LookupContextNode] = BEGIN tree: ConcreteRightSideListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideListmanyProdData ← NARROW[tree.data]; temp0 ← treeData.ConcreteRightSideItem.procs.FormRightSideContext[treeData.ConcreteRightSideItem, treeData.ConcreteRightSideList.procs.FormRightSideContext[treeData.ConcreteRightSideList, context]]; END END; ConcreteRightSideItemropeProdSyntaxRightSideFileCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemropeProdData ← NARROW[tree.data]; BEGIN itemRope: ROPE; itemRope ← RopeFromRopeNode[treeData.Rope]; temp0 ← ConcatCode3[RopeCode[" \""], RopeCode[itemRope], RopeCode["\" "]]; END; END END; ConcreteRightSideItemropeProdFormNodeVarAssignCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemropeProdData ← NARROW[tree.data]; temp0 ← BuildEmptyCode[]; END END; ConcreteRightSideItemropeProdFormTypeList: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: TypeListNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemropeProdData ← NARROW[tree.data]; temp0 ← BuildEmptyTypeList[]; END END; ConcreteRightSideItemropeProdFormNameList: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: NameListNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemropeProdData ← NARROW[tree.data]; temp0 ← BuildEmptyNameList[]; END END; ConcreteRightSideItemropeProdFormRightSideContext: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: LookupContextNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemropeProdData ← NARROW[tree.data]; BEGIN check: BOOLEAN; check ← CheckLegalRopeToken[context, treeData.Rope]; temp0 ← context; END; END END; ConcreteRightSideItemmodIdProdSyntaxRightSideFileCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemmodIdProdData ← NARROW[tree.data]; temp0 ← RopeCode1["%g ", IdFill[treeData.ModId.procs.FormFirstId[treeData.ModId]]]; END END; ConcreteRightSideItemmodIdProdFormNodeVarAssignCode: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: MesaCodeNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemmodIdProdData ← NARROW[tree.data]; temp0 ← ConcatCode2[RopeCode1["%g ← NARROW[stack.first];\N", NameFill[treeData.ModId.procs.FormName[treeData.ModId]]], RopeCode["stack ← stack.rest;\N"]]; END END; ConcreteRightSideItemmodIdProdFormTypeList: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: TypeListNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemmodIdProdData ← NARROW[tree.data]; BEGIN type: TypeNode; name: NameNode; name ← BuildName[treeData.ModId.procs.FormFirstId[treeData.ModId]]; type ← LookUpGrammarSymbol[context, name]; temp0 ← BuildOneTypeList[type]; END; END END; ConcreteRightSideItemmodIdProdFormNameList: PUBLIC PROC[ref: REF ANY] RETURNS[temp0: NameListNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemmodIdProdData ← NARROW[tree.data]; temp0 ← BuildOneNameList[treeData.ModId.procs.FormName[treeData.ModId]]; END END; ConcreteRightSideItemmodIdProdFormRightSideContext: PUBLIC PROC[ref: REF ANY, context: LookupContextNode] RETURNS[temp0: LookupContextNode] = BEGIN tree: ConcreteRightSideItemNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ConcreteRightSideItemmodIdProdData ← NARROW[tree.data]; BEGIN type: TypeNode; type ← LookUpGrammarSymbol[context, BuildName[treeData.ModId.procs.FormFirstId[treeData.ModId]]]; temp0 ← PushLocalRSS[context, treeData.ModId.procs.FormName[treeData.ModId], type]; END; END END; BuildExpmodIdProdFormBuildLengthCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpmodIdProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; nodeCode: MesaCodeNode; unused: TypeNode; use: UsageNode; [nodeCode, unused, use] ← treeData.ModId.procs.FormExpCode[treeData.ModId, context, usage]; code ← RopeCode1["%g.length", CodeFill[nodeCode]]; temp1 ← use; temp0 ← code; END; END END; BuildExpmodIdProdFormBuildPositionCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpmodIdProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; nodeCode: MesaCodeNode; unused: TypeNode; use: UsageNode; [nodeCode, unused, use] ← treeData.ModId.procs.FormExpCode[treeData.ModId, context, usage]; code ← RopeCode1["%g.position", CodeFill[nodeCode]]; temp1 ← use; temp0 ← code; END; END END; BuildExpmodIdProdFormBuildExpCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: TypeNode, temp2: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpmodIdProdData ← NARROW[tree.data]; [temp0, temp1, temp2] ← treeData.ModId.procs.FormExpCode[treeData.ModId, context, usage]; END END; BuildExpbuildNodeProdFormBuildLengthCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpbuildNodeProdData ← NARROW[tree.data]; [temp0, temp1] ← treeData.IntervalExp.procs.FormIntervalBuildLengthCode[treeData.IntervalExp, treeData.BuildExpList, nested, context, usage]; END END; BuildExpbuildNodeProdFormBuildPositionCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpbuildNodeProdData ← NARROW[tree.data]; [temp0, temp1] ← treeData.IntervalExp.procs.FormIntervalBuildPositionCode[treeData.IntervalExp, treeData.BuildExpList, nested, context, usage]; END END; BuildExpbuildNodeProdFormBuildExpCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: TypeNode, temp2: UsageNode] = BEGIN tree: BuildExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpbuildNodeProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; use: UsageNode; check: BOOLEAN; type: TypeNode; argTypes: TypeListNode; name: NameNode; spacerCode: MesaCodeNode; expCode: MesaCodeNode; expListTypes: TypeListNode; use1: UsageNode; intervalCode: MesaCodeNode; positionCode: MesaCodeNode; use0: UsageNode; lengthCode: MesaCodeNode; use00: UsageNode; [lengthCode, use00] ← treeData.IntervalExp.procs.FormIntervalBuildLengthCode[treeData.IntervalExp, treeData.BuildExpList, nested, context, usage]; [positionCode, use0] ← treeData.IntervalExp.procs.FormIntervalBuildPositionCode[treeData.IntervalExp, treeData.BuildExpList, nested, context, use00]; intervalCode ← RopeCode2["%g, %g", CodeFill[positionCode], CodeFill[lengthCode]]; [expCode, expListTypes, use1] ← treeData.BuildExpList.procs.FormBuildExpListCode[treeData.BuildExpList, context, use0]; IF TestEmptyCode[expCode] THEN {spacerCode ← BuildEmptyCode[]; } ELSE {spacerCode ← RopeCode[", "]; }; name ← treeData.ModId.procs.FormName[treeData.ModId]; [type, argTypes] ← LookUpAbstractProduction[context, name]; check ← CompareValTypesWithVarTypes[expListTypes, argTypes]; use ← RecordAbstProdUse[use1, name, Use.import, context]; code ← RopeCode4["Build%gProdNode[%g%g%g]", NameFill[name], CodeFill[intervalCode], CodeFill[spacerCode], CodeFill[expCode]]; temp2 ← use; temp1 ← type; temp0 ← code; END; END END; BuildExpListemptyProdFormBuildLengthCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; IF EmptyRSContext[context] THEN {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["length"]; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← BuildErrorCode["expecting a build exp list"]; }; END END; BuildExpListemptyProdFormBuildPositionCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; IF EmptyRSContext[context] THEN {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["position"]; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← BuildErrorCode["expecting a build exp list"]; }; END END; BuildExpListemptyProdFormBuildExpListCode: PUBLIC PROC[ref: REF ANY, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: TypeListNode, temp2: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp2 ← FakeUsageCopy[usage]; temp1 ← BuildEmptyTypeList[]; temp0 ← BuildEmptyCode[]; END END; BuildExpListoneProdFormBuildLengthCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListoneProdData ← NARROW[tree.data]; [temp0, temp1] ← treeData.BuildExp.procs.FormBuildLengthCode[treeData.BuildExp, nested, context, usage]; END END; BuildExpListoneProdFormBuildPositionCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListoneProdData ← NARROW[tree.data]; [temp0, temp1] ← treeData.BuildExp.procs.FormBuildPositionCode[treeData.BuildExp, nested, context, usage]; END END; BuildExpListoneProdFormBuildExpListCode: PUBLIC PROC[ref: REF ANY, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: TypeListNode, temp2: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListoneProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; type: TypeNode; use: UsageNode; True: BOOLEAN; True ← EqualRopes["True", "True"]; [code, type, use] ← treeData.BuildExp.procs.FormBuildExpCode[treeData.BuildExp, True, context, usage]; temp2 ← use; temp1 ← BuildOneTypeList[type]; temp0 ← code; END; END END; BuildExpListmanyProdFormBuildLengthCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListmanyProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; expPosCode: MesaCodeNode; use: UsageNode; expLengthCode: MesaCodeNode; use2: UsageNode; listPosCode: MesaCodeNode; use1: UsageNode; [listPosCode, use1] ← treeData.BuildExpList.procs.FormBuildPositionCode[treeData.BuildExpList, nested, context, usage]; [expLengthCode, use2] ← treeData.BuildExp.procs.FormBuildLengthCode[treeData.BuildExp, nested, context, use1]; [expPosCode, use] ← treeData.BuildExp.procs.FormBuildPositionCode[treeData.BuildExp, nested, context, use2]; code ← RopeCode3["%g + %g - %g", CodeFill[expPosCode], CodeFill[expLengthCode], CodeFill[listPosCode]]; temp1 ← use; temp0 ← code; END; END END; BuildExpListmanyProdFormBuildPositionCode: PUBLIC PROC[ref: REF ANY, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListmanyProdData ← NARROW[tree.data]; [temp0, temp1] ← treeData.BuildExpList.procs.FormBuildPositionCode[treeData.BuildExpList, nested, context, usage]; END END; BuildExpListmanyProdFormBuildExpListCode: PUBLIC PROC[ref: REF ANY, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: TypeListNode, temp2: UsageNode] = BEGIN tree: BuildExpListNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: BuildExpListmanyProdData ← NARROW[tree.data]; BEGIN code: MesaCodeNode; types: TypeListNode; expCode: MesaCodeNode; type: TypeNode; use: UsageNode; listCode: MesaCodeNode; types1: TypeListNode; use1: UsageNode; True: BOOLEAN; True ← EqualRopes["True", "True"]; [listCode, types1, use1] ← treeData.BuildExpList.procs.FormBuildExpListCode[treeData.BuildExpList, context, usage]; [expCode, type, use] ← treeData.BuildExp.procs.FormBuildExpCode[treeData.BuildExp, True, context, use1]; types ← AppendToTypeList[types1, type]; code ← ConcatCode3[listCode, RopeCode[", "], expCode]; temp2 ← use; temp1 ← types; temp0 ← code; END; END END; IntervalExpnoneProdFormIntervalBuildLengthCode: PUBLIC PROC[ref: REF ANY, expList: BuildExpListNode, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: IntervalExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; IF nested THEN {[temp0, temp1] ← expList.procs.FormBuildLengthCode[expList, nested, context, usage]; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["length"]; }; END END; IntervalExpnoneProdFormIntervalBuildPositionCode: PUBLIC PROC[ref: REF ANY, expList: BuildExpListNode, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: IntervalExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; IF nested THEN {[temp0, temp1] ← expList.procs.FormBuildPositionCode[expList, nested, context, usage]; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["position"]; }; END END; IntervalExppresentProdFormIntervalBuildLengthCode: PUBLIC PROC[ref: REF ANY, expList: BuildExpListNode, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: IntervalExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: IntervalExppresentProdData ← NARROW[tree.data]; IF nested THEN {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.closed] THEN {BEGIN code: MesaCodeNode; right: MesaCodeNode; unused: TypeNode; use: UsageNode; left: MesaCodeNode; unused1: TypeNode; use1: UsageNode; [left, unused1, use1] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; [right, unused, use] ← treeData.ModIdright.procs.FormExpCode[treeData.ModIdright, context, use1]; code ← RopeCode3["%g.position + %g.length - %g.position", CodeFill[right], CodeFill[right], CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.leftOpen] THEN {BEGIN code: MesaCodeNode; right: MesaCodeNode; unused: TypeNode; use: UsageNode; left: MesaCodeNode; unused1: TypeNode; use1: UsageNode; [left, unused1, use1] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; [right, unused, use] ← treeData.ModIdright.procs.FormExpCode[treeData.ModIdright, context, use1]; code ← RopeCode4["%g.position + %g.length - %g.position - %g.length", CodeFill[right], CodeFill[right], CodeFill[left], CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.rightOpen] THEN {BEGIN code: MesaCodeNode; right: MesaCodeNode; unused: TypeNode; use: UsageNode; left: MesaCodeNode; unused1: TypeNode; use1: UsageNode; [left, unused1, use1] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; [right, unused, use] ← treeData.ModIdright.procs.FormExpCode[treeData.ModIdright, context, use1]; code ← RopeCode2["%g.position - %g.length", CodeFill[right], CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {BEGIN code: MesaCodeNode; right: MesaCodeNode; unused: TypeNode; use: UsageNode; left: MesaCodeNode; unused1: TypeNode; use1: UsageNode; [left, unused1, use1] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; [right, unused, use] ← treeData.ModIdright.procs.FormExpCode[treeData.ModIdright, context, use1]; code ← RopeCode3["%g.position - %g.position - %g.length", CodeFill[right], CodeFill[left], CodeFill[left]]; temp1 ← use; temp0 ← code; END; }; }; }; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["length"]; }; END END; IntervalExppresentProdFormIntervalBuildPositionCode: PUBLIC PROC[ref: REF ANY, expList: BuildExpListNode, nested: BOOLEAN, context: LookupContextNode, usage: UsageNode] RETURNS[temp0: MesaCodeNode, temp1: UsageNode] = BEGIN tree: IntervalExpNode← NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: IntervalExppresentProdData ← NARROW[tree.data]; IF nested THEN {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.closed] THEN {BEGIN code: MesaCodeNode; left: MesaCodeNode; unused: TypeNode; use: UsageNode; [left, unused, use] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; code ← RopeCode1["%g.position", CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.leftOpen] THEN {BEGIN code: MesaCodeNode; left: MesaCodeNode; unused: TypeNode; use: UsageNode; [left, unused, use] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; code ← RopeCode2["%g.position + %g.length", CodeFill[left], CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {IF EqualIntervalForm[treeData.IntervalFormform, IntervalForm.rightOpen] THEN {BEGIN code: MesaCodeNode; left: MesaCodeNode; unused: TypeNode; use: UsageNode; [left, unused, use] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; code ← RopeCode1["%g.position", CodeFill[left]]; temp1 ← use; temp0 ← code; END; } ELSE {BEGIN code: MesaCodeNode; left: MesaCodeNode; unused: TypeNode; use: UsageNode; [left, unused, use] ← treeData.ModIdleft.procs.FormExpCode[treeData.ModIdleft, context, usage]; code ← RopeCode2["%g.position + %g.length", CodeFill[left], CodeFill[left]]; temp1 ← use; temp0 ← code; END; }; }; }; } ELSE {temp1 ← FakeUsageCopy[usage]; temp0 ← RopeCode["position"]; }; END END; END..