public void AddRow(ExpressionList row) { if (row.Count != fielddefs.Count) { throw new Exception("The row has the incorrect number of fields, " + row.Count.ToString() + " expected " + fielddefs.Count.ToString()); } rows.Add(row); }
public ExpressionList Optimize(OptimizationParams op) { ExpressionList r = new ExpressionList(); foreach (Expression x in this) { r.Add(x.Optimize(op)); } return(r); }
/// <summary> /// Evaluates a list of expressions and returns a list of values /// </summary> /// <param name="list"></param> /// <returns></returns> public List <HeronValue> EvalList(ExpressionList list) { List <HeronValue> r = new List <HeronValue>(); foreach (Expression e in list) { r.Add(Eval(e)); } return(r); }
public static ExpressionList CreateCompoundExpr(ParseNode x) { ExpressionList r = new ExpressionList(); foreach (ParseNode child in x.Children) { int i = 0; Expression tmp = CreateExpr(child, ref i); r.Add(tmp); } return(r); }
public static ExpressionList CreateAnnotations(ParseNode x) { ParseNode anns = x.GetChild("annotations"); ExpressionList r = new ExpressionList(); if (anns == null) { return(r); } foreach (ParseNode y in anns.Children) { r.Add(CreateExpr(y)); } return(r); }
private static void CreateModuleDefn(ModuleDefn m, ParseNode x) { ParseNode imports = x.GetChild("imports"); if (imports != null) { foreach (ParseNode import in imports.Children) { string modAlias = import.GetChild(0).ToString(); string modDefName = import.GetChild(1).ToString().RemoveInternalWSpace(); ExpressionList args = CreateCompoundExpr(import.GetChild(2)); m.AddImport(modAlias, modDefName, args); } } ParseNode inherits = x.GetChild("inherits"); if (inherits != null) { if (inherits.GetNumChildren() != 1) { throw new Exception("A module can only inherit from exactly one other module"); } m.SetBaseClass(CreateTypeRef(inherits.GetChild(0))); } ParseNode methods = x.GetChild("methods"); if (methods != null) { foreach (ParseNode node in methods.Children) { FunctionDefn f = CreateMethod(node, m); m.AddMethod(f); } } ProcessFields(x, m); }
public TupleExpr(ExpressionList xs) { exprs = xs; }
public FunCall(Expression f, ExpressionList args) { funexpr = f; this.args = args; }
public NewExpr(TypeRef type, ExpressionList args, string module) { this.type = type; this.args = args; this.module = module; }
public RecordExpr(ExpressionList fields, FormalArgs args) { this.fields = fields; this.fielddefs = args; }
public void AddImport(string sModAlias, string sModName, ExpressionList args) { imports.Add(new Import(sModAlias, sModName, args)); }
public Import(string alias, string module, ExpressionList args) { this.module = module; this.alias = alias; this.args = args; }