Exemplo n.º 1
0
        static void Main(string[] args)
        {
			string path = null;
			if (args.Length > 0) 
				path = args [0];
			else 
				path = "../../../../Bas/_tank.bas";
            // print the file path 
            System.Console.WriteLine("Run file: " + path);

            // read the source
            string sourceCode = System.IO.File.ReadAllText(path);

            // lex  
            Tokenizer tok = new Tokenizer(sourceCode);
            // parser 
            Parser parser = new Parser(tok);
            // runtime
            Runtime rt = new Runtime(parser);
            rt.SetAPI(new DebugAPI());

            rt.Run();

            // wait for key press 
            System.Console.ReadKey();
        }
Exemplo n.º 2
0
        /// <summary>
        /// run the program 
        /// </summary>
        /// <param name="code"></param>
        static public DebugAPI RunProgram( string code )
        {
            Tokenizer tokenizer = new Tokenizer(code);
            Parser parser = new Parser(tokenizer);
            Runtime rt = new Runtime(parser);

            DebugAPI api = new DebugAPI();
            rt.SetAPI(api);

            rt.Run();

            while (!rt.Step()) ;

            return api;
        }