示例#1
0
        public VarAssignment CreateVarAssignment(StringBuilder code)
        {
            string s    = code.ToString().Trim();
            string name = GetOperand(code);

            if (!game.IsVariable(name))
            {
                throw new Exception(s + " is not a valid variable");
            }

            s = code.ToString().Trim();
            if (s[0] != '=')
            {
                throw new Exception("expected = near " + s);
            }

            s = s.Substring(1).Trim();

            // if (!Char.IsLetter(s[0]))
            //     throw new Exception("unexpected symbol near " + s);

            IIntResult rhs = BuildExprTree(new StringBuilder(s));

            VarAssignment v = new VarAssignment()
            {
                VarName = name,
                Right   = rhs
            };

            return(v);
        }
        public void Visit(VarAssignment va)
        {
//            Console.WriteLine("pop stack into a ");
//          Console.WriteLine("sta " + va.VarName + ", a");
            sw.WriteLine("\t;variable assignment");
            sw.WriteLine("\tpla");
            sw.WriteLine("\tsta " + va.VarName);
        }
示例#3
0
 public void Visit(VarAssignment m)
 {
     sw.WriteLine("\tnop ;writing a set var statement");
     sw.WriteLine("\tpop ax");
     sw.WriteLine("\tmov " + m.VarName + ",al");
 }
 public void Visit(VarAssignment m)
 {
     sw.WriteLine(Tabs() + "//writing a set var statement");
     sw.WriteLine(Tabs() + "param1 = param_stack_pop();");
     sw.WriteLine(Tabs() + m.VarName + " = param1;");
 }
示例#5
0
 //void Visit(Assign m);
 public void Visit(VarAssignment m)
 {
     sw.WriteLine("\t;writing a set var statement");
     sw.WriteLine("\tpuls a");
     sw.WriteLine("\tsta " + m.VarName);
 }
示例#6
0
        //void Visit(Assign m);

        public void Visit(VarAssignment m)
        {
            sw.WriteLine("\t; var assignment");
            sw.WriteLine("\tpop af");
            sw.WriteLine("\tld (" + m.VarName + "),a");
        }