Beispiel #1
0
        public void Load(string src, bool DoNotAutostep = true)
        {
            var ast = _p.Parse(src);

            Ast             = ast;
            ProgramCounter  = 0;
            ProgramHasEnded = false;
            MethodTable     = new Lib.Dictionary <int, int>();

            for (int i = 0; i < ast.Count; i++)
            {
                if (ast[i] is MethodStmt)
                {
                    var x = ast[i] as MethodStmt;
                    MethodTable.Add(x.ID, i);
                }
            }

            if (!DoNotAutostep)
            {
                while (!ProgramHasEnded)
                {
                    Step();
                }
            }
        }
Beispiel #2
0
 public Out()
 {
     Name      = "out";
     Functions = new Lib.Dictionary <string, Delegate>();
     Functions.Add("println", new Action <object>(Out.printl));
     Functions.Add("print", new Action <object>(Out.print));
     Functions.Add("printc", new Action <object, string>(Out.printc));
     Functions.Add("printlnc", new Action <object, string>(Out.printlnc));
 }
Beispiel #3
0
 public Out()
 {
     Name = "out";
     Functions = new Lib.Dictionary<string, Delegate>();
     Functions.Add("println", new Action<object>(Out.printl));
     Functions.Add("print", new Action<object>(Out.print));
     Functions.Add("printc", new Action<object, string>(Out.printc));
     Functions.Add("printlnc", new Action<object, string>(Out.printlnc));
 }
Beispiel #4
0
        public void Load(string src, bool DoNotAutostep = true)
        {
            var ast = _p.Parse(src);
            Ast = ast;
            ProgramCounter = 0;
            ProgramHasEnded = false;
            MethodTable = new Lib.Dictionary<int, int>();

            for (int i = 0; i < ast.Count; i++)
            {
                if (ast[i] is MethodStmt)
                {
                    var x = ast[i] as MethodStmt;
                    MethodTable.Add(x.ID, i);
                }
            }

            if (!DoNotAutostep)
            {
                while(!ProgramHasEnded)
                {
                    Step();
                }
            }
        }