DIRECTORY
	ThreeC4RecFcnDeclDef,
	ThreeC4BaseDecl1Def,
	ThreeC4BasicAbTypesDef,
	ThreeC4BaseDecl2Def;

ThreeC4RecFcnImplAbGramDef: CEDAR DEFINITIONS = 
BEGIN
OPEN ThreeC4RecFcnDeclDef, ThreeC4BaseDecl1Def, ThreeC4BasicAbTypesDef, ThreeC4BaseDecl2Def;
ProdImplFileCodeProcType: TYPE = PROC[REF ANY, LookupContextNode, NameNode, NameNode, UsageNode] RETURNS[MesaCodeNode, UsageNode];

CompForArgsProcType: TYPE = PROC[REF ANY, TreeCallFlag, IntegerNode, LookupContextNode, UsageNode] RETURNS[MesaCodeNode, MesaCodeNode, MesaCodeNode, MesaCodeNode, TypeListNode, IntegerNode, UsageNode];

CompForVarsProcType: TYPE = PROC[REF ANY, NameListNode, IntegerNode, LookupContextNode, UsageNode] RETURNS[MesaCodeNode, MesaCodeNode, TypeListNode, NameListNode, IntegerNode, UsageNode];

CountValsProcType: TYPE = PROC[REF ANY, LookupContextNode] RETURNS[IntegerNode];

CompWhereProcType: TYPE = PROC[REF ANY, IntegerNode, LookupContextNode, UsageNode] RETURNS[MesaCodeNode, MesaCodeNode, IntegerNode, LookupContextNode, UsageNode];

FcnImplGraphNode: TYPE = REF FcnImplGraphNodeBody;
FcnImplGraphNodeBody: TYPE;

SlotListNode: TYPE = REF SlotListNodeBody;
SlotListNodeBody: TYPE;

CallGraphNodeNode: TYPE = REF CallGraphNodeNodeBody;
CallGraphNodeNodeBody: TYPE;

BuildFcnImplGraph: PROC[LookupContextNode, IdentifierNode, NameListNode] RETURNS[FcnImplGraphNode];

FakeCopyFcnImplGraph: PROC[FcnImplGraphNode] RETURNS[FcnImplGraphNode];

RecordCall: PROC[FcnImplGraphNode, LookupContextNode, IdentifierNode, SlotListNode, CallGraphNodeNode] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

RecordAssignment: PROC[FcnImplGraphNode, NameListNode, SlotListNode, CallGraphNodeNode] RETURNS[FcnImplGraphNode, CallGraphNodeNode];

RecordSequential: PROC[FcnImplGraphNode, CallGraphNodeNode, CallGraphNodeNode] RETURNS[FcnImplGraphNode, CallGraphNodeNode];

RecordParallel: PROC[FcnImplGraphNode, CallGraphNodeNode, CallGraphNodeNode] RETURNS[FcnImplGraphNode, CallGraphNodeNode];

RecordCondition: PROC[FcnImplGraphNode, SlotListNode, CallGraphNodeNode, SlotListNode, CallGraphNodeNode, SlotListNode, CallGraphNodeNode] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

RecordSimpleVarUse: PROC[FcnImplGraphNode, LookupContextNode, IdentifierNode] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

RecordModIdUse: PROC[FcnImplGraphNode, LookupContextNode, IdentifierNode, IdentifierNode] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

RecordLiteralUse: PROC[FcnImplGraphNode, INT] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

OpenWithWhereList: PROC[FcnImplGraphNode] RETURNS[FcnImplGraphNode];

CloseWithWhereList: PROC[FcnImplGraphNode] RETURNS[FcnImplGraphNode];

CheckFcnImpl: PROC[LookupContextNode, FcnImplGraphNode, SlotListNode, CallGraphNodeNode] RETURNS[BOOLEAN];

ConcatSlotList: PROC[SlotListNode, SlotListNode] RETURNS[SlotListNode];

BuildEmptySlotList: PROC RETURNS[SlotListNode];

BuildEmptyCallGraphNode: PROC RETURNS[CallGraphNodeNode];

FormFcnImplGraphProcType: TYPE = PROC[REF ANY, LookupContextNode, FcnImplGraphNode] RETURNS[FcnImplGraphNode, SlotListNode, CallGraphNodeNode];

FormFcnImplWhereGraphProcType: TYPE = PROC[REF ANY, LookupContextNode, FcnImplGraphNode] RETURNS[FcnImplGraphNode, CallGraphNodeNode];


-- AbProductionFcnImplProd

AbProductionFcnImplProdData: TYPE = REF AbProductionFcnImplProdDataBody;
AbProductionFcnImplProdDataBody: TYPE = RECORD[
ModId: ModIdNode, ModIdList: ModIdListNode, RecFcnImplList: RecFcnImplListNode];

AbProductionFcnImplProdProcs: AbProductionFcnImplNodeProcs;

BuildAbProductionFcnImplProdNode: PROC[position: INT, length: INT, ModId: ModIdNode, ModIdList: ModIdListNode, RecFcnImplList: RecFcnImplListNode]
	RETURNS[AbProductionFcnImplNode];

AbProductionFcnImplProdImplFileCode: ImplFileCodeProcType;

--RecFcnImplList

RecFcnImplListNode: TYPE = REF RecFcnImplListNodeBody;
RecFcnImplListNodeBody: TYPE = RECORD[
	position: INT, length: INT,
	procs: RecFcnImplListNodeProcs,
	data: REF ANY];

RecFcnImplListNodeProcs: TYPE = REF RecFcnImplListNodeProcsBody;
RecFcnImplListNodeProcsBody: TYPE = RECORD[

	ProdImplFileCode: ProdImplFileCodeProcType];


-- RecFcnImplListoneProd

RecFcnImplListoneProdData: TYPE = REF RecFcnImplListoneProdDataBody;
RecFcnImplListoneProdDataBody: TYPE = RECORD[
Identifier: IdentifierNode, IdList: IdListNode, RecExpression: RecExpressionNode];

RecFcnImplListoneProdProcs: RecFcnImplListNodeProcs;

BuildRecFcnImplListoneProdNode: PROC[position: INT, length: INT, Identifier: IdentifierNode, IdList: IdListNode, RecExpression: RecExpressionNode]
	RETURNS[RecFcnImplListNode];

RecFcnImplListoneProdProdImplFileCode: ProdImplFileCodeProcType;

-- RecFcnImplListmanyProd

RecFcnImplListmanyProdData: TYPE = REF RecFcnImplListmanyProdDataBody;
RecFcnImplListmanyProdDataBody: TYPE = RECORD[
RecFcnImplLista: RecFcnImplListNode, RecFcnImplListb: RecFcnImplListNode];

RecFcnImplListmanyProdProcs: RecFcnImplListNodeProcs;

BuildRecFcnImplListmanyProdNode: PROC[position: INT, length: INT, RecFcnImplLista: RecFcnImplListNode, RecFcnImplListb: RecFcnImplListNode]
	RETURNS[RecFcnImplListNode];

RecFcnImplListmanyProdProdImplFileCode: ProdImplFileCodeProcType;

--RecExpression

RecExpressionNode: TYPE = REF RecExpressionNodeBody;
RecExpressionNodeBody: TYPE = RECORD[
	position: INT, length: INT,
	procs: RecExpressionNodeProcs,
	data: REF ANY];

RecExpressionNodeProcs: TYPE = REF RecExpressionNodeProcsBody;
RecExpressionNodeProcsBody: TYPE = RECORD[

	CompForArgs: CompForArgsProcType, 
	CompForVars: CompForVarsProcType, 
	CountVals: CountValsProcType, 
	FormFcnImplGraph: FormFcnImplGraphProcType];


-- RecExpressionwithWhereListProd

RecExpressionwithWhereListProdData: TYPE = REF RecExpressionwithWhereListProdDataBody;
RecExpressionwithWhereListProdDataBody: TYPE = RECORD[
RecExpression: RecExpressionNode, WhereExpSeq: WhereExpSeqNode];

RecExpressionwithWhereListProdProcs: RecExpressionNodeProcs;

BuildRecExpressionwithWhereListProdNode: PROC[position: INT, length: INT, RecExpression: RecExpressionNode, WhereExpSeq: WhereExpSeqNode]
	RETURNS[RecExpressionNode];

RecExpressionwithWhereListProdCompForArgs: CompForArgsProcType;
RecExpressionwithWhereListProdCompForVars: CompForVarsProcType;
RecExpressionwithWhereListProdCountVals: CountValsProcType;
RecExpressionwithWhereListProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressioncondProd

RecExpressioncondProdData: TYPE = REF RecExpressioncondProdDataBody;
RecExpressioncondProdDataBody: TYPE = RECORD[
RecExpressionifClause: RecExpressionNode, RecExpressionthenClause: RecExpressionNode, RecExpressionelseClause: RecExpressionNode];

RecExpressioncondProdProcs: RecExpressionNodeProcs;

BuildRecExpressioncondProdNode: PROC[position: INT, length: INT, RecExpressionifClause: RecExpressionNode, RecExpressionthenClause: RecExpressionNode, RecExpressionelseClause: RecExpressionNode]
	RETURNS[RecExpressionNode];

RecExpressioncondProdCompForArgs: CompForArgsProcType;
RecExpressioncondProdCompForVars: CompForVarsProcType;
RecExpressioncondProdCountVals: CountValsProcType;
RecExpressioncondProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressioncallProd

RecExpressioncallProdData: TYPE = REF RecExpressioncallProdDataBody;
RecExpressioncallProdDataBody: TYPE = RECORD[
Identifier: IdentifierNode, RecExpSeq: RecExpSeqNode];

RecExpressioncallProdProcs: RecExpressionNodeProcs;

BuildRecExpressioncallProdNode: PROC[position: INT, length: INT, Identifier: IdentifierNode, RecExpSeq: RecExpSeqNode]
	RETURNS[RecExpressionNode];

RecExpressioncallProdCompForArgs: CompForArgsProcType;
RecExpressioncallProdCompForVars: CompForVarsProcType;
RecExpressioncallProdCountVals: CountValsProcType;
RecExpressioncallProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionseqProd

RecExpressionseqProdData: TYPE = REF RecExpressionseqProdDataBody;
RecExpressionseqProdDataBody: TYPE = RECORD[
RecExpSeq: RecExpSeqNode];

RecExpressionseqProdProcs: RecExpressionNodeProcs;

BuildRecExpressionseqProdNode: PROC[position: INT, length: INT, RecExpSeq: RecExpSeqNode]
	RETURNS[RecExpressionNode];

RecExpressionseqProdCompForArgs: CompForArgsProcType;
RecExpressionseqProdCompForVars: CompForVarsProcType;
RecExpressionseqProdCountVals: CountValsProcType;
RecExpressionseqProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionidProd

RecExpressionidProdData: TYPE = REF RecExpressionidProdDataBody;
RecExpressionidProdDataBody: TYPE = RECORD[
Identifier: IdentifierNode];

RecExpressionidProdProcs: RecExpressionNodeProcs;

BuildRecExpressionidProdNode: PROC[position: INT, length: INT, Identifier: IdentifierNode]
	RETURNS[RecExpressionNode];

RecExpressionidProdCompForArgs: CompForArgsProcType;
RecExpressionidProdCompForVars: CompForVarsProcType;
RecExpressionidProdCountVals: CountValsProcType;
RecExpressionidProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionmodIdProd

RecExpressionmodIdProdData: TYPE = REF RecExpressionmodIdProdDataBody;
RecExpressionmodIdProdDataBody: TYPE = RECORD[
Identifiera: IdentifierNode, Identifierb: IdentifierNode];

RecExpressionmodIdProdProcs: RecExpressionNodeProcs;

BuildRecExpressionmodIdProdNode: PROC[position: INT, length: INT, Identifiera: IdentifierNode, Identifierb: IdentifierNode]
	RETURNS[RecExpressionNode];

RecExpressionmodIdProdCompForArgs: CompForArgsProcType;
RecExpressionmodIdProdCompForVars: CompForVarsProcType;
RecExpressionmodIdProdCountVals: CountValsProcType;
RecExpressionmodIdProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionropeProd

RecExpressionropeProdData: TYPE = REF RecExpressionropeProdDataBody;
RecExpressionropeProdDataBody: TYPE = RECORD[
Rope: RopeNode];

RecExpressionropeProdProcs: RecExpressionNodeProcs;

BuildRecExpressionropeProdNode: PROC[position: INT, length: INT, Rope: RopeNode]
	RETURNS[RecExpressionNode];

RecExpressionropeProdCompForArgs: CompForArgsProcType;
RecExpressionropeProdCompForVars: CompForVarsProcType;
RecExpressionropeProdCountVals: CountValsProcType;
RecExpressionropeProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionnumbProd

RecExpressionnumbProdData: TYPE = REF RecExpressionnumbProdDataBody;
RecExpressionnumbProdDataBody: TYPE = RECORD[
NonNegInteger: NonNegIntegerNode];

RecExpressionnumbProdProcs: RecExpressionNodeProcs;

BuildRecExpressionnumbProdNode: PROC[position: INT, length: INT, NonNegInteger: NonNegIntegerNode]
	RETURNS[RecExpressionNode];

RecExpressionnumbProdCompForArgs: CompForArgsProcType;
RecExpressionnumbProdCompForVars: CompForVarsProcType;
RecExpressionnumbProdCountVals: CountValsProcType;
RecExpressionnumbProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionsourcePositionProd

RecExpressionsourcePositionProdData: TYPE = REF RecExpressionsourcePositionProdDataBody;
RecExpressionsourcePositionProdDataBody: TYPE = RECORD[
ModId: ModIdNode];

RecExpressionsourcePositionProdProcs: RecExpressionNodeProcs;

BuildRecExpressionsourcePositionProdNode: PROC[position: INT, length: INT, ModId: ModIdNode]
	RETURNS[RecExpressionNode];

RecExpressionsourcePositionProdCompForArgs: CompForArgsProcType;
RecExpressionsourcePositionProdCompForVars: CompForVarsProcType;
RecExpressionsourcePositionProdCountVals: CountValsProcType;
RecExpressionsourcePositionProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpressionsourceLengthProd

RecExpressionsourceLengthProdData: TYPE = REF RecExpressionsourceLengthProdDataBody;
RecExpressionsourceLengthProdDataBody: TYPE = RECORD[
ModId: ModIdNode];

RecExpressionsourceLengthProdProcs: RecExpressionNodeProcs;

BuildRecExpressionsourceLengthProdNode: PROC[position: INT, length: INT, ModId: ModIdNode]
	RETURNS[RecExpressionNode];

RecExpressionsourceLengthProdCompForArgs: CompForArgsProcType;
RecExpressionsourceLengthProdCompForVars: CompForVarsProcType;
RecExpressionsourceLengthProdCountVals: CountValsProcType;
RecExpressionsourceLengthProdFormFcnImplGraph: FormFcnImplGraphProcType;

--RecExpSeq

RecExpSeqNode: TYPE = REF RecExpSeqNodeBody;
RecExpSeqNodeBody: TYPE = RECORD[
	position: INT, length: INT,
	procs: RecExpSeqNodeProcs,
	data: REF ANY];

RecExpSeqNodeProcs: TYPE = REF RecExpSeqNodeProcsBody;
RecExpSeqNodeProcsBody: TYPE = RECORD[

	CompForArgs: CompForArgsProcType, 
	CompForVars: CompForVarsProcType, 
	CountVals: CountValsProcType, 
	FormFcnImplGraph: FormFcnImplGraphProcType];


-- RecExpSeqemptyProd

RecExpSeqemptyProdData: TYPE = REF RecExpSeqemptyProdDataBody;
RecExpSeqemptyProdDataBody: TYPE = RECORD[
];

RecExpSeqemptyProdProcs: RecExpSeqNodeProcs;

BuildRecExpSeqemptyProdNode: PROC[position: INT, length: INT]
	RETURNS[RecExpSeqNode];

RecExpSeqemptyProdCompForArgs: CompForArgsProcType;
RecExpSeqemptyProdCompForVars: CompForVarsProcType;
RecExpSeqemptyProdCountVals: CountValsProcType;
RecExpSeqemptyProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpSeqoneProd

RecExpSeqoneProdData: TYPE = REF RecExpSeqoneProdDataBody;
RecExpSeqoneProdDataBody: TYPE = RECORD[
RecExpression: RecExpressionNode];

RecExpSeqoneProdProcs: RecExpSeqNodeProcs;

BuildRecExpSeqoneProdNode: PROC[position: INT, length: INT, RecExpression: RecExpressionNode]
	RETURNS[RecExpSeqNode];

RecExpSeqoneProdCompForArgs: CompForArgsProcType;
RecExpSeqoneProdCompForVars: CompForVarsProcType;
RecExpSeqoneProdCountVals: CountValsProcType;
RecExpSeqoneProdFormFcnImplGraph: FormFcnImplGraphProcType;

-- RecExpSeqmanyProd

RecExpSeqmanyProdData: TYPE = REF RecExpSeqmanyProdDataBody;
RecExpSeqmanyProdDataBody: TYPE = RECORD[
RecExpSeqa: RecExpSeqNode, RecExpSeqb: RecExpSeqNode];

RecExpSeqmanyProdProcs: RecExpSeqNodeProcs;

BuildRecExpSeqmanyProdNode: PROC[position: INT, length: INT, RecExpSeqa: RecExpSeqNode, RecExpSeqb: RecExpSeqNode]
	RETURNS[RecExpSeqNode];

RecExpSeqmanyProdCompForArgs: CompForArgsProcType;
RecExpSeqmanyProdCompForVars: CompForVarsProcType;
RecExpSeqmanyProdCountVals: CountValsProcType;
RecExpSeqmanyProdFormFcnImplGraph: FormFcnImplGraphProcType;

--WhereExpSeq

WhereExpSeqNode: TYPE = REF WhereExpSeqNodeBody;
WhereExpSeqNodeBody: TYPE = RECORD[
	position: INT, length: INT,
	procs: WhereExpSeqNodeProcs,
	data: REF ANY];

WhereExpSeqNodeProcs: TYPE = REF WhereExpSeqNodeProcsBody;
WhereExpSeqNodeProcsBody: TYPE = RECORD[

	CompWhere: CompWhereProcType, 
	FormFcnImplWhereGraph: FormFcnImplWhereGraphProcType];


-- WhereExpSeqoneProd

WhereExpSeqoneProdData: TYPE = REF WhereExpSeqoneProdDataBody;
WhereExpSeqoneProdDataBody: TYPE = RECORD[
IdList: IdListNode, RecExpression: RecExpressionNode];

WhereExpSeqoneProdProcs: WhereExpSeqNodeProcs;

BuildWhereExpSeqoneProdNode: PROC[position: INT, length: INT, IdList: IdListNode, RecExpression: RecExpressionNode]
	RETURNS[WhereExpSeqNode];

WhereExpSeqoneProdCompWhere: CompWhereProcType;
WhereExpSeqoneProdFormFcnImplWhereGraph: FormFcnImplWhereGraphProcType;

-- WhereExpSeqmanyProd

WhereExpSeqmanyProdData: TYPE = REF WhereExpSeqmanyProdDataBody;
WhereExpSeqmanyProdDataBody: TYPE = RECORD[
WhereExpSeqa: WhereExpSeqNode, WhereExpSeqb: WhereExpSeqNode];

WhereExpSeqmanyProdProcs: WhereExpSeqNodeProcs;

BuildWhereExpSeqmanyProdNode: PROC[position: INT, length: INT, WhereExpSeqa: WhereExpSeqNode, WhereExpSeqb: WhereExpSeqNode]
	RETURNS[WhereExpSeqNode];

WhereExpSeqmanyProdCompWhere: CompWhereProcType;
WhereExpSeqmanyProdFormFcnImplWhereGraph: FormFcnImplWhereGraphProcType;
END..