LogicodeLang / Logicode

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

Another KeyError! #19

Closed hanyuone closed 8 years ago

hanyuone commented 8 years ago
Traceback (most recent call last):
  File "logicode.py", line 527, in <module>
    Run(code)
  File "logicode.py", line 484, in Run
    result = statement[0](scope)
  File "logicode.py", line 77, in <lambda>
    return lambda scope: scope[result[0]]
  File "logicode.py", line 217, in __getitem__
    return self.parent[key]
KeyError: 'circ'

This happened with this code:

var length_digit=00
circ successor(n)->[
    cond ((~n)<)->successor((~((~n)>))+0)/(~((~n)>)+1)
]
out successor(length_digit)
somebody1234 commented 8 years ago

This is supposed to happen, either do

var length_digit=00
circ successor(n)->[
    cond ((~n)<)->var output = successor((~((~n)>))+0) / var output = (~((~n)>)+1)
    output
]
out successor(length_digit)

Or if you want support for expression conds just tell me

hanyuone commented 8 years ago

Oh... that's what you're meant to do.

Can we make an extra keyword (ret) for returns, or do we just do implicit returns?

hanyuone commented 8 years ago
var length_digit=111
circ trim(n)->[
    cond (n<)->var test2=n/var test2=trim(n>)
    test2
]
circ successor(n)->[
    cond ((~n)<)->var test=successor(~((~(0+trim(n)))>))+0/var test=~((~(0+trim(n)))>)+1
    test
]
out successor(length_digit)

@somebody1234 The error is happening again...