예제 #1
0
        static void Main(string[] args)
        {
            Executor exec = new Executor();

            while (true) // loop
            {
                Console.Write(" {0} | ", exec.DataStack.ToString()); // print
                var line = Console.ReadLine();

                exec.CodeStack.PushRange(Lexer.Parse(line).Value); // read
                exec.Methods["stream-tcp"] = new Executor.NativeFunction(Builtins.FileTcpIo.NewTcpStream);
                exec.Methods["file-read"] = new Executor.NativeFunction(Builtins.FileTcpIo.ReadFile);
                exec.Methods["file-write"] = new Executor.NativeFunction(Builtins.FileTcpIo.WriteFile);

                try {
                    while (exec.CodeStack.Count > 0)
                        exec.Cycle(); // eval
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception: {0}", e.Message);
                }
            }
        }
예제 #2
0
 public void Run(Executor exec)
 {
     _methodToRun(exec);
 }
예제 #3
0
 public void Run(Executor exec)
 {
     exec.CodeStack.PushRange(Tokens);
 }