<> <> <<>> DIRECTORY AlgebraClasses, Exprs; ExprsImpl: CEDAR PROGRAM IMPORTS AlgebraClasses EXPORTS Exprs = BEGIN OPEN AC: AlgebraClasses; <> Object: TYPE = AC.Object; Method: TYPE = AC.Method; <> Recast: AC.UnaryOp = { toExprMethod: Method _ AC.LookupMethodForStructure[$toExpr, arg.class]; RETURN[AC.ApplyMethodNoChecks[toExprMethod, LIST[arg] ]; }; CanRecast: AC.UnaryPredicate = { RETURN[TRUE]; }; <> <> <> <<}; >> <<>> <> <<}; >> <<>> <> ExprsClass: Object _ AC.MakeClass["ExprsClass", NIL, NIL]; Exprs: PUBLIC Object _ AC.MakeStructure["Exprs", ExprsClass, NIL]; categoryMethod: Method _ AC.MakeMethod[Value, FALSE, Exprs, NEW[AC.Category _ set], NIL, NIL]; recastMethod: Method _ AC.MakeMethod[UnaryOp, TRUE, Exprs, NEW[AC.UnaryOp _ Recast], NIL, "recast"]; canRecastMethod: Method _ AC.MakeMethod[UnaryPredicate, TRUE, Exprs, NEW[AC.UnaryPredicate _ CanRecast], NIL, "canRecast"]; toExprMethod: Method _ AC.MakeMethod[ToExprOp, TRUE, Exprs, NEW[AC.ToExprOp _ ToExpr], NEW[AC.UnaryToListOp _ AC.DefaultDesiredArgStructures], "toExpr"]; compoundExprMethod: Method _ AC.MakeMethod[BinaryOp, TRUE, Exprs, NEW[AC.BinaryOp _ MakeCompoundExpr], NIL, "compoundExpr"]; AC.AddMethodToClass[$category, categoryMethod, ExprsClass]; AC.AddMethodToClass[$recast, recastMethod, ExprsClass]; AC.AddMethodToClass[$canRecast, canRecastMethod, ExprsClass]; AC.AddMethodToClass[$toExpr, toExprMethod, ExprsClass]; AC.AddMethodToClass[$compoundExpr, compoundExprMethod, ExprsClass]; AC.InstallStructure[Exprs]; END.