//Function: Main //Purpose: Main function of the program. Also serves as the driver for the program static void Main(string[] args) { string oberon_file = debug_directory + DecodeArguments(args); RDParser parser = new RDParser(oberon_file); parser.Parse(); // Hold the output until the user wants to end the program. Console.Write("Press a key to end... "); Console.ReadKey(); }
/// <summary> /// /// </summary> static void TestSecondScript() { string a = "PRINTLINE -2*10;" + "\r\n" + "PRINTLINE -10*-1;\r\n PRINT 2*10;\r\n"; RDParser p = new RDParser(a); ArrayList arr = p.Parse(); foreach (object obj in arr) { Stmt s = obj as Stmt; s.Execute(null); } }
/// <summary> /// Driver routine to call the program script /// </summary> static void TestFileScript(string filename) { if (filename == null) { return; } // -------------- Read the contents from the file StreamReader sr = new StreamReader(filename); string programs2 = sr.ReadToEnd(); //---------------- Creates the Parser Object // With Program text as argument RDParser pars = null; pars = new RDParser(programs2); // Create a Compilation Context // // COMPILATION_CONTEXT ctx = new COMPILATION_CONTEXT(); // // Call the top level Parsing Routine with // Compilation Context as the Argument // ArrayList stmts = pars.Parse(ctx); // // if we have reached here , the parse process // is successful... Create a Run time context and // Call Execute statements of each statement... // RUNTIME_CONTEXT f = new RUNTIME_CONTEXT(); foreach (Object obj in stmts) { Stmt s = obj as Stmt; s.Execute(f); } }