// Print token public static void PrintToken(string token, int tkCode) { Console.Write ("Lexeme: " + token.PadRight(10) + " Token Code: " + tkCode.ToString().PadRight(10)); Console.Write (" Mnemonic: " + CodeTable.LookupCode(tkCode).PadRight(10)); // If token is within the symbol table, report it index if (CodeTable.LookupName(CodeTable.LookupCode(tkCode)) == 50 || CodeTable.LookupName(CodeTable.LookupCode(tkCode)) == 51 || CodeTable.LookupName(CodeTable.LookupCode(tkCode)) == 52) { Console.Write (" Symbol Table Index: " + symbolTable.LookupSymbol(token)); } Console.WriteLine(); }
// Returns the 'name' associated with an opcode from the reserve table public string GetMnemonic(int opcode) { return(_reserveTable.LookupCode(opcode)); }