/// <summary> /// create a new expression node /// </summary> /// <param name="kind"></param> /// <param name="type"></param> /// <param name="name"></param> /// <param name="Linenum"></param> /// <param name="scope"></param> public TreeNode(ExpKind kind, TokenType type, string name, int Linenum, string scope) : this() { this.NodeKind = NodeKind.expK; this.Kind = kind; this.Type = type; this.Name = name; this.LineNum = Linenum; this.Scope = scope; }
public TreeNode(ExpKind exp) // creates a TreeNode of Attribute { childrens = new TreeNode[3]; for (int i = 0; i < 3; i++) { childrens[i] = null; } nodekind = NodeKind.ExpK; expkind = exp; }
public void CopyFrom(ExpDesc e) { this.Kind = e.Kind; this.Info = e.Info; // this.Ind.T = e.Ind.T; // this.Ind.Idx = e.Ind.Idx; // this.Ind.Vt = e.Ind.Vt; this.Ind = e.Ind; this.NumberValue = e.NumberValue; this.ExitTrue = e.ExitTrue; this.ExitFalse = e.ExitFalse; }
TreeNode newExpNode(ExpKind kind) { TreeNode t = new TreeNode(); int i; if (t == null) { Console.Write("Out of memory error at line %d\n"); } else { for (i = 0; i < MAXCHILDREN; i++) { t.child.Add(null); } t.sibling = null; t.nodekind = NodeKind.ExpK; t.kind.exp = kind; t.type = ExpType.Void; } return(t); }
public static bool VKIsInReg(ExpKind k) { return(k == ExpKind.VNONRELOC || k == ExpKind.VLOCAL); }
public static bool VKIsVar(ExpKind k) { return((int)ExpKind.VLOCAL <= (int)k && (int)k <= (int)ExpKind.VINDEXED); }
public static bool VKIsInReg( ExpKind k ) { return k == ExpKind.VNONRELOC || k == ExpKind.VLOCAL; }
public static bool VKIsVar( ExpKind k ) { return ((int)ExpKind.VLOCAL <= (int)k && (int)k <= (int)ExpKind.VINDEXED); }
private void InitExp( ExpDesc e, ExpKind k, int i ) { e.Kind = k; e.Info = i; e.ExitTrue = Coder.NO_JUMP; e.ExitFalse = Coder.NO_JUMP; }
public void CopyFrom( ExpDesc e ) { this.Kind = e.Kind; this.Info = e.Info; // this.Ind.T = e.Ind.T; // this.Ind.Idx = e.Ind.Idx; // this.Ind.Vt = e.Ind.Vt; this.Ind = e.Ind; this.NumberValue = e.NumberValue; this.ExitTrue = e.ExitTrue; this.ExitFalse = e.ExitFalse; }
private bool HasMultiRet( ExpKind k ) { return k == ExpKind.VCALL || k == ExpKind.VVARARG; }