Exemplo n.º 1
0
 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++;
     }
 }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
        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");
            }
        }