public NodeBinOp(BinOp type, AstNode left, AstNode right) : base("Binary Operation", NodeType.Operation) { Type = type; AddChild (left); AddChild (right); }
public NodeIf(AstNode predicate, AstNode body, AstNode elseBody = null) : base("If Statement", NodeType.Statement) { AddChild (predicate); AddChild (body); AddChild (elseBody ?? new AstNode ()); }
public NodeFuncCall(AstNode left, AstNode args) : base("Function Call", NodeType.Function) { AddChild (left); AddChild (args); }
public void AddChild(AstNode node) { Children.Add (node); }
void DumpAst(AstNode node, int depth = 0) { Console.WriteLine ("{0}* {1}", "".PadLeft (depth * 2, ' '), node.Name); foreach (var child in node.Children) DumpAst (child, depth + 1); }
public NodeUnOp(UnOp type, AstNode val) : base("Unary Operation", NodeType.Operation) { Type = type; AddChild (val); }