-- ThreeC4CProdAbGram.ThreeC4
-- Sturgis, May 10, 1986 2:59:25 pm PDT

Include[ThreeC4BaseDecl, ThreeC4RecFcnDecl, ThreeC4BasicAbTypes];

ThreeC4CProdAbGram: Module =
Begin

-- NOTE: must eventually remove FormExpCode and FormExpListCode from main collection of recursive functions.  However, FormExpCode is still applied to ModId, but only for use here.

-- this module contains the abstract grammar for concrete productions and build expressions


-- the following are used here and in CProdImpl


IntervalForm: EnumeratedBaseType = {closed, leftOpen, rightOpen, fullOpen};

EqualIntervalForm: BaseFunction[IntervalForm.a, IntervalForm.b] Returns[BOOLEAN];

DotedNameFill: BaseFunction[Name] Returns[CodeFiller];



FormBuildExpCode: TreeRecursiveFunction[Tree, BOOLEAN, LookupContext, Usage.arg]
	Returns[MesaCode, Type, Usage.result]
	DamagedReps[Usage.arg];
FormBuildExpListCode: TreeRecursiveFunction[Tree, LookupContext, Usage.arg]
	Returns[MesaCode, TypeList, Usage.result]
	DamagedReps[Usage.arg];
FormBuildPositionCode: TreeRecursiveFunction[Tree, BOOLEAN, LookupContext, Usage.arg]
	Returns[MesaCode, Usage.result]
	DamagedReps[Usage.arg];
FormBuildLengthCode: TreeRecursiveFunction[Tree, BOOLEAN, LookupContext, Usage.arg]
	Returns[MesaCode, Usage.result]
	DamagedReps[Usage.arg];

FormIntervalBuildPositionCode:
	TreeRecursiveFunction[Tree, BuildExpList, BOOLEAN, LookupContext, Usage.arg]
	Returns[MesaCode, Usage.result]
	DamagedReps[Usage.arg];
FormIntervalBuildLengthCode:
	TreeRecursiveFunction[Tree, BuildExpList, BOOLEAN, LookupContext, Usage.arg]
	Returns[MesaCode, Usage.result]
	DamagedReps[Usage.arg];

	

-- the ConcreteProduction abstract type  is declared in BasicAbTypes

ConcreteProduction: AbstractProduction[ModId, ConcreteRightSideList, BuildExp];

ConcreteRightSideList: AbstractType[FormRightSideContext, FormNameList, FormTypeList, FormNodeVarAssignCode, SyntaxRightSideFileCode];
	ConcreteRightSideList.empty: AbstractProduction[];
	ConcreteRightSideList.one: AbstractProduction[ConcreteRightSideItem];
	ConcreteRightSideList.many: AbstractProduction[ConcreteRightSideList, ConcreteRightSideItem];

ConcreteRightSideItem: AbstractType[FormRightSideContext, FormNameList, FormTypeList, FormNodeVarAssignCode, SyntaxRightSideFileCode];
	ConcreteRightSideItem.rope: AbstractProduction[Rope];
	ConcreteRightSideItem.modId: AbstractProduction[ModId];

BuildExp: AbstractType[FormBuildExpCode, FormBuildPositionCode, FormBuildLengthCode];
	BuildExp.modId: AbstractProduction[ModId];
	BuildExp.buildNode: AbstractProduction[ModId, IntervalExp, BuildExpList];
	
BuildExpList: AbstractType[FormBuildExpListCode, FormBuildPositionCode, FormBuildLengthCode];
	BuildExpList.empty: AbstractProduction[];
	BuildExpList.one: AbstractProduction[BuildExp];
	BuildExpList.many: AbstractProduction[BuildExpList, BuildExp];

IntervalExp: AbstractType[FormIntervalBuildPositionCode, FormIntervalBuildLengthCode];
	IntervalExp.none: AbstractProduction[];
	IntervalExp.present: AbstractProduction[IntervalForm.form, ModId.left, ModId.right]


End.