<> <> <> <> <<>> <> Include [ SaffronBaseDecls, SaffronTreeDecls, SaffronAG, SaffronProgramGraphDecls ]; SaffronValueCompile1: Module = Begin <> <<>> for Exp.sum: AbstractProduction [ Exp.left, AddOp, Exp.right ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ CastIntegerValue[ if IsPlus[AddOp] then Add[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else Sub[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] where lhs _ DemandNumber[uncheckedLhs] where rhs _ DemandNumber[uncheckedRhs] where uncheckedRhs _ EvaluateExpression[Exp.right, lc, fl, cs, targetType] where uncheckedLhs _ EvaluateExpression[Exp.left, lc, fl, cs, targetType] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if And[And[Static[lhs], Static[rhs]], And[ConformsToInteger[lhsType], ConformsToInteger[rhsType]]] <> then CastIntegerValue[ if IsPlus[AddOp] then Add[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else Sub[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] else (MakeRuntimeValue[code, targetType] -- is targetType correct here? where code _ ConcatProgramFragments[ConcatProgramFragments[pushLHS, pushRHS], op] where pushLHS _ Code[lhs] where pushRHS _ Code[rhs] where op _ if IsPlus[AddOp] then MakePGAdd[] else MakePGSubtract[] ) where lhsType _ Type[lhs] where rhsType _ Type[rhs] where lhs _ DemandNumber[uncheckedLhs] where rhs _ DemandNumber[uncheckedRhs] where _ CompileExpression[Exp.right, contextTree1, cs, targetType] where _ CompileExpression[Exp.left, contextTree, cs, targetType] <> let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Arithmetic expression used as l-value"] ; for Exp.unarysum: AbstractProduction [ AddOp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ CastIntegerValue[ if IsPlus[AddOp] then RetrieveIntegerValue[rhs] else Neg[RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] where rhs _ DemandNumber[uncheckedRhs] where uncheckedRhs _ EvaluateExpression[Exp, lc, fl, cs, targetType] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if And[Static[rhs], ConformsToInteger[rhsType]] then CastIntegerValue[ if IsPlus[AddOp] then RetrieveIntegerValue[rhs] else Neg[RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] else (MakeRuntimeValue[code, targetType] -- is targetType correct here? where code _ if IsPlus[AddOp] then ConcatProgramFragments[pushRHS, MakePGNoOp[]] else ConcatProgramFragments[pushRHS, MakePGNegate[]] where pushRHS _ Code[rhs] ) where rhsType _ Type[rhs] where rhs _ DemandNumber[uncheckedRhs] where _ CompileExpression[Exp, contextTree, cs, targetType] <> let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Arithmetic expression used as l-value"] ; for Exp.product: AbstractProduction [ Exp.left, MultOp, Exp.right ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ CastIntegerValue[ if IsTimes[MultOp] then Mul[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else if IsDivide[MultOp] then Div[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else Mod[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] where lhs _ DemandNumber[uncheckedLhs] where rhs _ DemandNumber[uncheckedRhs] where uncheckedRhs _ EvaluateExpression[Exp.right, lc, fl, cs, targetType] where uncheckedLhs _ EvaluateExpression[Exp.left, lc, fl, cs, targetType] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if And[And[Static[lhs], Static[rhs]], And[ConformsToInteger[lhsType], ConformsToInteger[rhsType]]] then CastIntegerValue[ if IsTimes[MultOp] then Mul[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else if IsDivide[MultOp] then Div[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]] else Mod[RetrieveIntegerValue[lhs], RetrieveIntegerValue[rhs]], GetIntrinsicIntegerTypes[cs]] else (MakeRuntimeValue[code, targetType] -- is targetType correct here? where code _ ConcatProgramFragments[ConcatProgramFragments[pushLHS, pushRHS], op] where pushLHS _ Code[lhs] where pushRHS _ Code[rhs] where op _ if IsTimes[MultOp] then MakePGMultiply[] else if IsDivide[MultOp] then MakePGDivide[] else MakePGMod[] ) <> where lhsType _ Type[lhs] where rhsType _ Type[rhs] where lhs _ DemandNumber[uncheckedLhs] where rhs _ DemandNumber[uncheckedRhs] where _ CompileExpression[Exp.right, contextTree1, cs, targetType] where _ CompileExpression[Exp.left, contextTree, cs, targetType] <> let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Arithmetic expression used as l-value"] ; for Exp.or: AbstractProduction [ Exp.left, Exp.right ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeStaticBoolean[Or[BooleanValue[lhs], BooleanValue[rhs]], boolean] where rhs _ EvaluateAndTypeCheckExpression[Exp.right, lc, fl, cs, boolean] where lhs _ EvaluateAndTypeCheckExpression[Exp.left, lc, fl, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if And[Static[lhs], Static[rhs]] then MakeStaticBoolean[Or[BooleanValue[lhs], BooleanValue[rhs]], boolean] else (MakeRuntimeValue[code, boolean] where code _ ConcatProgramFragments[ConcatProgramFragments[pushLHS, pushRHS], op] where pushLHS _ Code[lhs] where pushRHS _ Code[rhs] where op _ MakePGOr[] ) where _ CompileAndTypeCheckExpression[Exp.right, contextTree1, cs, boolean] where _ CompileAndTypeCheckExpression[Exp.left, contextTree, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["OR expression used as l-value"] ; for Exp.and: AbstractProduction [ Exp.left, Exp.right ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeStaticBoolean[And[BooleanValue[lhs], BooleanValue[rhs]], boolean] where rhs _ EvaluateAndTypeCheckExpression[Exp.right, lc, fl, cs, boolean] where lhs _ EvaluateAndTypeCheckExpression[Exp.left, lc, fl, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if And[Static[lhs], Static[rhs]] then MakeStaticBoolean[And[BooleanValue[lhs], BooleanValue[rhs]], boolean] else (MakeRuntimeValue[code, boolean] where code _ ConcatProgramFragments[ConcatProgramFragments[pushLHS, pushRHS], op] where pushLHS _ Code[lhs] where pushRHS _ Code[rhs] where op _ MakePGAnd[] ) where _ CompileAndTypeCheckExpression[Exp.right, contextTree1, cs, boolean] where _ CompileAndTypeCheckExpression[Exp.left, contextTree, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["AND expression used as l-value"] ; for Exp.not: AbstractProduction [ Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeStaticBoolean[Not[BooleanValue[rhs]], boolean] where rhs _ EvaluateAndTypeCheckExpression[Exp, lc, fl, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ if Static[rhs] then MakeStaticBoolean[Not[BooleanValue[rhs]], boolean] else (MakeRuntimeValue[code, boolean] where code _ ConcatProgramFragments[Code[rhs], MakePGNot[]] ) where _ CompileAndTypeCheckExpression[Exp, contextTree, cs, boolean] where boolean _ GetIntrinsicBooleanType[cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["NOT expression used as l-value"] ; for Exp.relation: AbstractProduction [ Exp, Relation ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["relation"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["relation"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Relation used as l-value"] ; for Exp.ifthenelse: AbstractProduction [ Exp.cond, Exp.thenpart, Exp.elsepart ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ if BooleanValue[EvaluateAndTypeCheckExpression[Exp.cond, lc, fl, cs, boolean]] then EvaluateAndTypeCheckExpression[Exp.thenpart, lc, fl, cs, targetType] else EvaluateAndTypeCheckExpression[Exp.elsepart, lc, fl, cs, targetType] where boolean _ GetIntrinsicBooleanType[cs] let CompileExpression[tree, contextTree, cs, targetType] _ where _ if Static[condition] then if BooleanValue[condition] then CompileAndTypeCheckExpression[Exp.thenpart, contextTree1, cs, targetType] else CompileAndTypeCheckExpression[Exp.elsepart, contextTree1, cs, targetType] else ( -- is targetType correct here? where code _ MakePGTest[Code[condition], Code[thenPart], Code[elsePart]] where _ CompileAndTypeCheckExpression[Exp.elsepart, contextTree2, cs, targetType] where _ CompileAndTypeCheckExpression[Exp.thenpart, contextTree1, cs, targetType] ) where _ CompileAndTypeCheckExpression[Exp.cond, contextTree, cs, booleanType] where booleanType _ GetIntrinsicBooleanType[cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["IF expression used as l-value"] ; for Exp.select: AbstractProduction [ SelectHead, SelectExpList, Exp.default ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["select"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["select"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["SELECT expression used as l-value"] ; for Exp.assign: AbstractProduction [ Exp.lhs, Exp.rhs ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeTrash[targetType] where err _ Error["Exp.assign should never be evaluated!"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeRuntimeValue[code, tgn] where code _ ConcatProgramFragments[Code[rhsValue], storeTOS] where storeTOS _ if PFDIsLocal[lvalue] then MakePGStoreLocal[lvalue] else MakePGStoreIndirect[lvalue] where _ CompileAndTypeCheckExpression[Exp.rhs, contextTree, cs, tgn] where _ CompileLValue[Exp.lhs, contextTree, cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Assignment expression used as l-value"] ; for Exp.multiassign: AbstractProduction [ ExpList, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeTrash[targetType] where err _ Error["Exp.multiassign should never be evaluated!"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["multiassign"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Multiple assignment expression used as l-value"] ; for Exp.id: AbstractProduction [ Id ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ result where result _ if Static[value] then value else (MakeDummy[""] where err _ Error["blat"]) <> where _ DemandConstantField[field2] where field2 _ if FieldExists[field1] then field1 else LookupNameInContextRib[Id, ParentRib[lc]] where field1 _ LookupNameInFieldList[fl, Id] let CompileExpression[tree, contextTree, cs, targetType] _ where contextTree1 _ FakeDamageContextTree[contextTree] where result _ CompileLValueIntoRValue[expAsLValue, contextTree] where _ CompileLValue[tree, contextTree, cs] let CompileLValue[tree, contextTree, cs] _ GetPathToName[contextTree, Id] ; for Exp.num: AbstractProduction [ Num ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ result where result _ CastIntegerValue[integerValue, GetIntrinsicIntegerTypes[cs]] where integerValue _ IntegerValueFromLiteral[Num] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ CastIntegerValue[integerValue, GetIntrinsicIntegerTypes[cs]] where integerValue _ IntegerValueFromLiteral[Num] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Number literal used as l-value"] ; for Exp.string: AbstractProduction [ String ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["string"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["string"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["String literal used as l-value"] ; for Exp.flnum: AbstractProduction [ Flnum ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["flnum"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["flnum"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["REAL literal used as l-value"] ; for Exp.char: AbstractProduction [ Char ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["char"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["char"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Character literal used as l-value"] ; for Exp.atom: AbstractProduction [ Atom ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["atom"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["atom"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Character literal used as l-value"] ; for Exp.narrow: AbstractProduction [ Exp, OptType, Catch ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["narrow"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["narrow"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["NARROW expression used as l-value"] ; for Exp.loophole: AbstractProduction [ Exp, OptType ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["loophole"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["loophole"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["LOOPHOLE expression used as l-value"] ; for Exp.apply: AbstractProduction [ Exp.rator, Exp.rand, Catch ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["apply"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["apply"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Apply expression used as l-value"] ; for Exp.qualifier: AbstractProduction [ Exp, Qualifier ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["qualifier"] let CompileExpression[tree, contextTree, cs, targetType] _ CompileQualifiedExpression[Qualifier, value, contextTree1, cs, targetType] where _ CompileAndTypeCheckExpression[Exp, contextTree, cs, top] where top _ GetTop[cs] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Qualifier l-value not implemented yet!!!!!!!!!"] ; for Exp.explist: AbstractProduction [ ExpList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["explist"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["explist"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["ExpList l-value not implemented yet!!!!!!!!!"] ; for Exp.prefixop: AbstractProduction [ PrefixOp, OrderList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["prefixop"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["prefixop"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["PrefixOp expression used as l-value"] ; for Exp.val: AbstractProduction [ OrderList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["val"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["val"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Val expression used as l-value"] ; for Exp.all: AbstractProduction [ OrderList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["all"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["all"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["ALL expression used as l-value"] ; for Exp.new: AbstractProduction [ New, TypeExp, Initialization, Catch ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeTrash[targetType] where err _ Error["Should not be evaluating Exp.new!"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["new"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["NEW expression used as l-value"] ; for Exp.cons: AbstractProduction [ Cons, ExpList, Catch ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeTrash[targetType] where err _ Error["Should not be evaluating Exp.cons!"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["cons"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["CONS expression used as l-value"] ; for Exp.listcons: AbstractProduction [ ListCons, ExpList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeTrash[targetType] where err _ Error["Should not be evaluating Exp.listcons!"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["listcons"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["ListCons expression used as l-value"] ; for Exp.nil: AbstractProduction [ ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["nil"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["nil"] where contextTree1 _ FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["NIL expression used as l-value"] ; End; SaffronValueCompile2: Module = Begin for Exp.typeop: AbstractProduction [ TypeOp, TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ if TypeOpIsCode[TypeOp] then ( MakeDummy[""] where err _ Error["EvaluateExpression not implemented for code Exp.typeop"] ) else if TypeOpIsFirst[TypeOp] then EvaluateFirstOfTypeExpression[TypeExp, lc, fl, cs, targetType] else if TypeOpIsLast[TypeOp] then EvaluateLastOfTypeExpression[TypeExp, lc, fl, cs, targetType] else if TypeOpIsNil[TypeOp] then ( MakeDummy[""] where err _ Error["EvaluateExpression not implemented for nil Exp.typeop"] ) else ( MakeDummy[""] where err _ Error["in EvaluateExpression for Exp.typeop"] ) let CompileExpression[tree, contextTree, cs, targetType] _ if TypeOpIsCode[TypeOp] then ( where dummy _ MakeDummy[""] where contextTree1 _ FakeDamageContextTree[contextTree] where err _ Error["CompileExpression not implemented for code Exp.typeop"] ) else if TypeOpIsFirst[TypeOp] then ( where contextTree1 _ FakeDamageContextTree[contextTree] where first _ CompileFirstOfTypeExpression[TypeExp, contextTree, cs, targetType] ) else if TypeOpIsLast[TypeOp] then ( where contextTree1 _ FakeDamageContextTree[contextTree] where last _ CompileLastOfTypeExpression[TypeExp, contextTree, cs, targetType] ) else if TypeOpIsNil[TypeOp] then ( where dummy _ MakeDummy[""] where contextTree1 _FakeDamageContextTree[contextTree] where err _ Error["CompileExpression not implemented for nil Exp.typeop"] ) else ( where dummy _ MakeDummy[""] where contextTree1 _ FakeDamageContextTree[contextTree] where err _ Error["in CompileExpression for Exp.typeop"] ) let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["TypeOp expression used as l-value"] ; for Exp.size: AbstractProduction [ TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["size"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["size"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["SIZE expression used as l-value"] ; for Exp.size2: AbstractProduction [ TypeExp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["size2"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["size2"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["SIZE2 expression used as l-value"] ; for Exp.bits: AbstractProduction [ TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["bits"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["bits"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["BITS expression used as l-value"] ; for Exp.bits2: AbstractProduction [ TypeExp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["bits2"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["bits2"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["BITS2 expression used as l-value"] ; for Exp.bytes: AbstractProduction [ TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["bytes"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["bytes"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["BYTES expression used as l-value"] ; for Exp.bytes2: AbstractProduction [ TypeExp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["bytes2"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["bytes2"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["BYTES2 expression used as l-value"] ; for Exp.units: AbstractProduction [ TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["units"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["units"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["UNITS expression used as l-value"] ; for Exp.units2: AbstractProduction [ TypeExp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["units2"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["units2"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["UNITS2 expression used as l-value"] ; for Exp.words: AbstractProduction [ TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["words"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["words"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["WORDS expression used as l-value"] ; for Exp.words2: AbstractProduction [ TypeExp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["words2"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["words2"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["WORDS2 expression used as l-value"] ; for Exp.istype: AbstractProduction [ Exp, TypeExp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["istype"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["istype"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["ISTYPE expression used as l-value"] ; for Exp.address: AbstractProduction [ Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["address"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["address"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["@ expression used as l-value"] ; for Exp.descriptor: AbstractProduction [ DescList ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["descriptor"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["descriptor"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Descriptor used as l-value"] ; for Exp.error: AbstractProduction [ ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["error"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["error"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["ERROR used as l-value"] ; for Exp.transfer: AbstractProduction [ TransferOp, Exp ] let EvaluateExpression[tree, lc, fl, cs, targetType] _ MakeDummy["transfer"] let CompileExpression[tree, contextTree, cs, targetType] _ where result _ MakeDummy["transfer"] where contextTree1 _FakeDamageContextTree[contextTree] let CompileLValue[tree, contextTree, cs] _ where pfd _ EmptyPFD[] where tgn _ GetIntrinsicBooleanType[cs] -- any type will do... where err _ Error["Transfer expression used as l-value"] ; for Num.decimal: AbstractProduction [Decimalnum] let IntegerValueFromLiteral[tree] _ ParseIntegerLiteral[digits, 10] where digits _ RopeFromDecimalnum[Decimalnum]; for Num.octal: AbstractProduction [Octalnum] let IntegerValueFromLiteral[tree] _ ParseIntegerLiteral[digits, 8] where digits _ RopeFromOctalnum[Octalnum]; for Num.hex: AbstractProduction [Hexnum] let IntegerValueFromLiteral[tree] _ ParseIntegerLiteral[digits, 16] where digits _ RopeFromHexnum[Hexnum]; for AddOp.plus: AbstractProduction [] let IsPlus[tree] _ True[] let IsMinus[tree] _ False[]; for AddOp.minus: AbstractProduction [] let IsPlus[tree] _ False[] let IsMinus[tree] _ True[]; for MultOp.times: AbstractProduction [] let IsTimes[tree] _ True[] let IsDivide[tree] _ False[] let IsMod[tree] _ False[]; for MultOp.divide: AbstractProduction [] let IsTimes[tree] _ False[] let IsDivide[tree] _ True[] let IsMod[tree] _ False[]; for MultOp.mod: AbstractProduction [] let IsTimes[tree] _ False[] let IsDivide[tree] _ False[] let IsMod[tree] _ True[]; for Relop.eq: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.eq; for Relop.ne: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.ne; for Relop.lt: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.lt; for Relop.le: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.le; for Relop.gt: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.gt; for Relop.ge: AbstractProduction [] let GetRelationOp[tree] _ RelationOp.ge; for Initialization.empty: AbstractProduction [] let InitializationIsEmpty[tree] _ True[] let InitializationIsBinding[tree] _ False[] let InitializationIsAssignment[tree] _ False[] <>> <> <> <<;>> ; for Initialization.binding: AbstractProduction [InitialValue] let InitializationIsEmpty[tree] _ False[] let InitializationIsBinding[tree] _ True[] let InitializationIsAssignment[tree] _ False[] <> ; for Initialization.assignment: AbstractProduction [InitialValue] let InitializationIsEmpty[tree] _ False[] let InitializationIsBinding[tree] _ False[] let InitializationIsAssignment[tree] _ True[] <> ; <> <> <<;>> <<>> <> <> <<;>> <<>> <> <> <<;>> <<>> <> <> <> <> <<>> <> <> <<;>> <<>> <> <> <<;>> <<>> for TypeOp.code: AbstractProduction [] let TypeOpIsCode[tree] _ True[] let TypeOpIsFirst[tree] _ False[] let TypeOpIsLast[tree] _ False[] let TypeOpIsNil[tree] _ False[]; for TypeOp.first: AbstractProduction [] let TypeOpIsCode[tree] _ False[] let TypeOpIsFirst[tree] _ True[] let TypeOpIsLast[tree] _ False[] let TypeOpIsNil[tree] _ False[]; for TypeOp.last: AbstractProduction [] let TypeOpIsCode[tree] _ False[] let TypeOpIsFirst[tree] _ False[] let TypeOpIsLast[tree] _ True[] let TypeOpIsNil[tree] _ False[]; for TypeOp.nil: AbstractProduction [] let TypeOpIsCode[tree] _ False[] let TypeOpIsFirst[tree] _ False[] let TypeOpIsLast[tree] _ False[] let TypeOpIsNil[tree] _ True[]; for Qualifier.prefixop: AbstractProduction [PrefixOp] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.typeop: AbstractProduction [TypeOp] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.size: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.bits: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.bytes: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.units: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.words: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.apply: AbstractProduction [ExpList, Catch] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.apply"], FakeDamageContextTree[contextTree] > <> <> <>> <> <> <<)>> <> <>> <> <> <<)>> <>> <> <> <<)>> <> ; for Qualifier.select: AbstractProduction [Id] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; for Qualifier.indirect: AbstractProduction [] let CompileQualifiedExpression[tree, expValue, contextTree, cs, targetType] _ < MakeDummy["Qualifier.prefixop"], FakeDamageContextTree[contextTree] > ; End; SaffronTypeCompile: Module = Begin for TypeExp.record: AbstractProduction [ MachineDependent, Monitored, RecList ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of RECORD not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on RECORD types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on RECORD types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of RECORD not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on RECORD types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on RECORD types."] ; for TypeExp.union: AbstractProduction [ Tag, VariantList ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of UNION not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on UNION types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on UNION types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of UNION not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on UNION types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on UNION types."] ; for TypeExp.sequence: AbstractProduction [ Packed, Tag, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of SEQUENCE not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on SEQUENCE types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on SEQUENCE types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of SEQUENCE not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on SEQUENCE types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on SEQUENCE types."] ; for TypeExp.enum: AbstractProduction [ MachineDependent, ElementList ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Enumerated not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of Enumerated not implemented yet."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of Enumerated not implemented yet."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Enumerated not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of Enumerated not implemented yet."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of Enumerated not implemented yet."] ; for TypeExp.ref: AbstractProduction [ ReadOnly, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF types."] ; for TypeExp.refany: AbstractProduction [ ReadOnly ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF ANY not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF ANY types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF ANY types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF ANY not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF ANY types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF ANY types."] ; for TypeExp.refunspecified: AbstractProduction [ ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF UNSPECIFIED not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF UNSPECIFIED types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF UNSPECIFIED types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of REF UNSPECIFIED not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on REF UNSPECIFIED types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on REF UNSPECIFIED types."] ; for TypeExp.typeid: AbstractProduction [ TypeId ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateSizeOfTypeExpression[TypeId, lc, fl, cs, targetType] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateFirstOfTypeExpression[TypeId, lc, fl, cs, targetType] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateLastOfTypeExpression[TypeId, lc, fl, cs, targetType] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ CompileSizeOfTypeExpression[TypeId, contextTree, cs, targetType] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ CompileFirstOfTypeExpression[TypeId, contextTree, cs, targetType] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ CompileLastOfTypeExpression[TypeId, contextTree, cs, targetType] ; for TypeExp.subrange: AbstractProduction [ Subrange ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateSizeOfTypeExpression[Subrange, lc, fl, cs, targetType] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateFirstOfTypeExpression[Subrange, lc, fl, cs, targetType] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateLastOfTypeExpression[Subrange, lc, fl, cs, targetType] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ CompileSizeOfTypeExpression[Subrange, contextTree, cs, targetType] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ CompileFirstOfTypeExpression[Subrange, contextTree, cs, targetType] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ CompileLastOfTypeExpression[Subrange, contextTree, cs, targetType] ; for TypeExp.pointer: AbstractProduction [ Ordered, Base, PointerType ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of POINTER not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on POINTER types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on POINTER types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of POINTER not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on POINTER types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on POINTER types."] ; for TypeExp.var: AbstractProduction [ TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of VAR not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on VAR types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on VAR types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of VAR not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on VAR types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on VAR types."] ; for TypeExp.list: AbstractProduction [ ReadOnly, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of LIST not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on LIST types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on LIST types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of LIST not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on LIST types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on LIST types."] ; for TypeExp.array: AbstractProduction [ Packed, OptType, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of ARRAY not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on ARRAY types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on ARRAY types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of ARRAY not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on ARRAY types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on ARRAY types."] ; for TypeExp.descriptor: AbstractProduction [ ReadOnly, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of DESCRIPTOR not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on DESCRIPTOR types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on DESCRIPTOR types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of DESCRIPTOR not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on DESCRIPTOR types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on DESCRIPTOR types."] ; for TypeExp.transfer: AbstractProduction [ Safe, TransferMode, Arguments ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Transfer type not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on Transfer types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on Transfer types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Transfer type not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on Transfer types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on Transfer types."] ; for TypeExp.relative: AbstractProduction [ TypeId, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of RELATIVE not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on RELATIVE types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on RELATIVE types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of RELATIVE not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on RELATIVE types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on RELATIVE types."] ; for TypeExp.zone: AbstractProduction [ Uncounted ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of ZONE not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on ZONE types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on ZONE types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of ZONE not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on ZONE types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on ZONE types."] ; for TypeExp.long: AbstractProduction [ TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of LONG not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of LONG not implemented yet."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of LONG not implemented yet."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of LONG not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of LONG not implemented yet."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of LONG not implemented yet."] ; for TypeExp.frame: AbstractProduction [ Id ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of FRAME not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on FRAME types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on FRAME types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of FRAME not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on FRAME types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on FRAME types."] ; for TypeExp.painted: AbstractProduction [ TypeId, TypeExp ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of PAINTED not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on PAINTED types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on PAINTED types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of PAINTED not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on PAINTED types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on PAINTED types."] ; for TypeExp.typeapply: AbstractProduction [ TypeApply ] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of TypeApply not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on TypeApply types."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on TypeApply types."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of TypeApply not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST is not a valid operation on TypeApply types."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST is not a valid operation on TypeApply types."] ; for Subrange.named: AbstractProduction [TypeId, Interval] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Named subrange not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of Named subrange not implemented yet."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of Named subrange not implemented yet."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of Named subrange not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of Named subrange not implemented yet."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of Named subrange not implemented yet."] ; <<>> for Subrange.unnamed: AbstractProduction [Interval] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateSizeOfTypeExpression[Interval, lc, fl, cs, targetType] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateFirstOfTypeExpression[Interval, lc, fl, cs, targetType] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ EvaluateLastOfTypeExpression[Interval, lc, fl, cs, targetType] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ CompileSizeOfTypeExpression[Interval, contextTree, cs, targetType] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ CompileFirstOfTypeExpression[Interval, contextTree, cs, targetType] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ CompileLastOfTypeExpression[Interval, contextTree, cs, targetType] ; <<>> for Interval.cc: AbstractProduction [Bounds] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ First[targetType] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ Last[targetType] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ First[targetType] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ Last[targetType] ; for Interval.co: AbstractProduction [Bounds] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ First[targetType] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ Pred[Last[targetType]] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ First[targetType] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ Pred[Last[targetType]] ; for Interval.oc: AbstractProduction [Bounds] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ Succ[First[targetType]] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ Last[targetType] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ Succ[First[targetType]] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ Last[targetType] ; for Interval.oo: AbstractProduction [Bounds] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ Succ[First[targetType]] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ Pred[Last[targetType]] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of interval not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ Succ[First[targetType]] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ Pred[Last[targetType]] ; for TypeId.id: AbstractProduction [Id] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of id not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ First[tgn] where _ DemandTypeDeclarationField[field2] where field2 _ if FieldExists[field1] then field1 else LookupNameInContextRib[Id, ParentRib[lc]] where field1 _ LookupNameInFieldList[fl, Id] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ Last[tgn] where _ DemandTypeDeclarationField[field2] where field2 _ if FieldExists[field1] then field1 else LookupNameInContextRib[Id, ParentRib[lc]] where field1 _ LookupNameInFieldList[fl, Id] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of id not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ First[tgn] where _ DemandTypeDeclarationField[field] where field _ LookupNameInContextRib[Id, Rib[contextTree]] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ Last[tgn] where _ DemandTypeDeclarationField[field] where field _ LookupNameInContextRib[Id, Rib[contextTree]] ; for TypeId.qualifier: AbstractProduction [TypeId, Id] let EvaluateSizeOfTypeExpression[tree, lc, fl, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of TypeId.qualifier not implemented yet."] let EvaluateFirstOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of TypeId.qualifier not implemented yet."] let EvaluateLastOfTypeExpression[tree, lc, fl, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of TypeId.qualifier not implemented yet."] let CompileSizeOfTypeExpression[tree, contextTree, cs, targetType] _ DummyBigINT[] where err _ Error["SIZE of TypeId.qualifier not implemented yet."] let CompileFirstOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["FIRST of TypeId.qualifier not implemented yet."] let CompileLastOfTypeExpression[tree, contextTree, cs, targetType] _ MakeDummy[""] where err _ Error["LAST of TypeId.qualifier not implemented yet."] ; End.