// (C) 2008-2009 Dr. Gergo ERDI using System.Collections.Generic; using Alef.Runtime; namespace Alef.ID { class Plusint : Runtime.FunctionTag {} class Minusint : Runtime.FunctionTag {} class Mulint : Runtime.FunctionTag {} class Divint : Runtime.FunctionTag {} class Eqint : Runtime.FunctionTag {} class Ltint : Runtime.FunctionTag {} class Plusstring: Runtime.FunctionTag {} class Showint: Runtime.FunctionTag {} } namespace Alef.Prog.Int { class Plus: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload + (decimal)right.objPayload)); } } class Minus: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload - (decimal)right.objPayload)); } } class Mul: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload * (decimal)right.objPayload)); } } class Div: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload / (decimal)right.objPayload)); } } class Eq: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload == (decimal)right.objPayload)); } } class Lt: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((decimal)left.objPayload < (decimal)right.objPayload)); } } class Show: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; ReduceExprToCons (left); node.Overwrite (new Runtime.Node (((decimal)left.objPayload).ToString())); } } } namespace Alef.Prog.String { class Plus: Runtime.FunctionBase { internal override void Reduce (Runtime.Node node) { Node left = node.children[0]; Node right = node.children[1]; ReduceExprToCons (left); ReduceExprToCons (right); node.Overwrite (new Runtime.Node ((string)left.objPayload + (string)right.objPayload)); } } }