public SyntaxAnalyser(LexicalAnalyser s) { scanner = s; scope = "g"; symTable = new Dictionary <string, Symbol>(); symId = 0; // Add these keywords too symbol table because they should always exist globally string id = genId("A"); symTable.Add(id, new Symbol("g", id, "true", "ilit", new Dictionary <string, dynamic>() { { "type", "bool" } })); id = genId("A"); symTable.Add(id, new Symbol("g", id, "false", "ilit", new Dictionary <string, dynamic>() { { "type", "bool" } })); id = genId("A"); symTable.Add(id, new Symbol("g", id, "null", "ilit", new Dictionary <string, dynamic>() { { "type", "unknown" } })); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("No arguments"); return; } //string file = "semanticsTest.kxi"; string file = args[0]; LexicalAnalyser scanner = new LexicalAnalyser(file); SyntaxAnalyser syntaxAnalyser = new SyntaxAnalyser(scanner); syntaxAnalyser.go(); //syntaxAnalyser.printTable(); SemanticAnalyser semanticsAnalyser = new SemanticAnalyser(new LexicalAnalyser(file), syntaxAnalyser.symTable); semanticsAnalyser.go(); //semanticsAnalyser.printTable(); //semanticsAnalyser.PrintICode(); TargetCode target = new TargetCode(semanticsAnalyser.quads, semanticsAnalyser.symTable); target.go(); target.PrintTCode(); VM.go("output.asm"); //Console.ReadKey(); }