static void Main(string[] args) { var parser = new TCCLParser(); var name = "sem_test.txt"; Console.WriteLine("Parsing file " + name); parser.Parse(name); Console.WriteLine("Parsing complete"); Console.ReadLine(); }
static void Main(string[] args) { var parser = new TCCLParser(); string name; while (true) { Console.Write("Enter a file name: "); name = Console.ReadLine(); Console.WriteLine("Compiling file " + name); parser.Parse(name + ".txt"); Console.WriteLine("Semantic checking complete"); } }
static void Main(string[] args) { var parser = new TCCLParser(); while (true) { Console.Write("Enter a file name: "); var name = Console.ReadLine(); Console.WriteLine("Parsing file " + name); parser.Parse(name + ".txt"); Console.WriteLine("Parsing complete"); } }
static void Main(string[] args) { //SymbolTable st = new SymbolTable(); //CorrectnessChecks c1 = new CorrectnessChecks(st); //c1.run(); var parser = new TCCLParser(); string name; while (true) { Console.Write("Enter a file name: "); name = Console.ReadLine(); Console.WriteLine("Compiling file " + name); parser.Parse(name + ".txt"); Console.WriteLine("Semantic checking complete"); } }
static void Main(string[] args) { while (true) { var parser = new TCCLParser(); Console.WriteLine("Enter a file name."); string userInput = Console.ReadLine(); while (!File.Exists(userInput)) { Console.WriteLine("No such file. Try again."); userInput = Console.ReadLine(); } Console.WriteLine("Parsing file " + userInput); Console.WriteLine("------------------------------------------------------------------------"); parser.Parse(userInput); Console.WriteLine("------------------------------------------------------------------------"); Console.WriteLine("Parsing complete"); } }
static void Main(string[] args) { if (TEST) { string fileName = "test.il"; if (File.Exists(fileName)) { File.Delete(fileName); } using (StreamWriter sw = File.CreateText(fileName)) { //sw.WriteLine(".assembly HelloWorld { }\n" + // ".method public static void Main() cil managed\n" + // "{\n" + // "\t.entrypoint\n" + // "\t.maxstack 1\n" + // "\tldstr \"Hello World\"\n" + // "\tcall void [mscorlib]System.Console::WriteLine(string)\n" + // "\tret\n" + // "\n}"); sw.WriteLine(".assembly extern mscorlib {}\n" + ".assembly addnums {}\n" + // don't forget 2 headers ".class public hello\n" + "{\n" + ".method public void main() cil managed\n" + "{\n" + ".entrypoint\n" + ".maxstack 42\n" + "ldstr \"Hello, World Test\"\n" + "call void [mscorlib]System.Console::WriteLine(string)\n" + "ret\n" + "\n}" + "\n}"); } ILasm(fileName.Substring(0, fileName.Length - ".il".Length)); } else { var parser = new TCCLParser(); bool notQuit = true; string fileName = ""; while (notQuit) { bool fileIsValid = false; while (!fileIsValid) { Console.Write("Enter the file to parse (or 'quit'): "); fileName = Console.ReadLine(); if (!string.IsNullOrEmpty(fileName)) { fileName = fileName.Trim(); if (fileName.ToLower().Equals(QUIT)) { fileIsValid = true; notQuit = false; } else { if (fileName.Length < 4 || !fileName.Substring(fileName.Length - 4).Equals(".txt")) { fileName += ".txt"; } if (File.Exists(fileName)) { fileIsValid = true; } } } if (!fileIsValid) { Console.WriteLine("Unable to process given file name " + "\"{0}\", please try again.", fileName); } } if (notQuit) { Console.WriteLine("\nCompiling file " + fileName); parser.Parse(fileName); Console.WriteLine("\nAST complete"); ILasm(fileName.Substring(0, fileName.Length - ".txt".Length)); } Console.WriteLine("\nProgram complete. Press any key to close."); } } }