Exemple #1
0
 /// <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;
 }
Exemple #2
0
 /// <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;
        }
Exemple #4
0
 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;
 }
Exemple #5
0
        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);
        }
Exemple #6
0
 public static bool VKIsInReg(ExpKind k)
 {
     return(k == ExpKind.VNONRELOC || k == ExpKind.VLOCAL);
 }
Exemple #7
0
 public static bool VKIsVar(ExpKind k)
 {
     return((int)ExpKind.VLOCAL <= (int)k &&
            (int)k <= (int)ExpKind.VINDEXED);
 }
Exemple #8
0
		public static bool VKIsInReg( ExpKind k )
		{
			return k == ExpKind.VNONRELOC || k == ExpKind.VLOCAL;
		}
Exemple #9
0
		public static bool VKIsVar( ExpKind k )
		{
			return ((int)ExpKind.VLOCAL <= (int)k &&
					(int)k <= (int)ExpKind.VINDEXED);
		}
Exemple #10
0
		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;
		}
Exemple #11
0
		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;
		}
Exemple #12
0
		private bool HasMultiRet( ExpKind k )
		{
			return k == ExpKind.VCALL || k == ExpKind.VVARARG;
		}