LogicodeLang / Logicode

An esoteric language based on logic gates.
MIT License
12 stars 3 forks source link

Some issues with parser #11

Closed hanyuone closed 8 years ago

hanyuone commented 8 years ago

The circ parsing bit doesn't work with this code:

circ xor(a,b)->(!(a&b))&(a|b)
circ ha(a,b)->(a&b)+(xor(a,b))
circ fa(a,b,c)->(ha(ha(a,b),c)[h])+(ha(a,b)[t])|(ha(ha(a,b)[h],c)[t])
out fa(1,1,1)

Expected output is 11.

However, the interpreter popped out an error:

Traceback (most recent call last):
  File "logicode.py", line 467, in <module>
    Run(code)
  File "logicode.py", line 424, in Run
    result = statement[0](scope)
  File "logicode.py", line 54, in <lambda>
    return lambda scope: scope[result[0]]
  File "logicode.py", line 180, in __getitem__
    return self.parent[key]
KeyError: 'circ'