Revert "pytholite/compiler: SymbolStack"
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 10 Nov 2012 11:09:45 +0000 (12:09 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Sat, 10 Nov 2012 11:09:45 +0000 (12:09 +0100)
This reverts commit f57da497b2a96ab53de2fac37a34cdbc668c9636.

migen/pytholite/compiler.py

index 28fe19be55d98fbd05440465913e7b8a2e92b77b..14fb248b59141667f2fc4e77ae621b5d10a2a82b 100644 (file)
@@ -55,35 +55,13 @@ class _Register:
                sync = [Case(self.sel, *cases)]
                return Fragment(sync=sync)
 
-class _SymbolStack:
-       def __init__(self):
-               self.stack = []
-       
-       def push(self, init={}):
-               self.stack.append(init)
-       
-       def pop(self):
-               return self.stack.pop()
-       
-       def __setitem__(self, key, value):
-               self.stack[-1][key] = value
-       
-       def __getitem__(self, key):
-               for frame in reversed(self.stack):
-                       try:
-                               return frame[key]
-                       except KeyError:
-                               pass
-               raise KeyError
-               
 class _AbstractNextState:
        def __init__(self, target_state):
                self.target_state = target_state
 
 class _Compiler:
        def __init__(self, symdict, registers):
-               self.symdict = _SymbolStack()
-               self.symdict.push(symdict)
+               self.symdict = symdict
                self.registers = registers
                self.targetname = ""