public void InitialiseRegisternames()
 {
     foreach (var term in registerNames)
     {
         registerNames[tableEntryCounter]       = term;
         symbolTable[tableEntryCounter]         = new SymbolTableEntry();
         symbolTable[tableEntryCounter].Symbol  = registerNames[tableEntryCounter];
         symbolTable[tableEntryCounter].Address = tableEntryCounter;
         tableEntryCounter++;
     }
 }
 public void InitialiseSymbolTable()
 {
     //Initialise Register names
     InitialiseRegisternames();
     for (int j = tableEntryCounter; j < maxEntries; j++)
     {
         symbolTable[j]         = new SymbolTableEntry();
         symbolTable[j].Symbol  = null;
         symbolTable[j].Address = -1;
     }
 }
        public void addEntry(SymbolTableEntry entryVar)
        {
            int i = 0;

            while ((symbolTable[i].Symbol != entryVar.Symbol) && (symbolTable[i].Symbol != null) && (i < maxEntries))
            {
                i++;
            }
            if (symbolTable[i].Symbol == null)
            {
                symbolTable[i].Symbol  = entryVar.Symbol;
                symbolTable[i].Address = entryVar.Address;
            }

            else if ((symbolTable[i].Symbol == entryVar.Symbol) && (symbolTable[i].Address == -1))
            {
                symbolTable[i].Address = entryVar.Address;
            }

            else if (i > maxEntries)
            {
                Console.WriteLine("\nSymbol table is full, Increase maxEntry and recompile");
            }
        }