You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for example , just input "hello wolrd" after call repl()
"hello world" will be splitted to two tokens like ("hello) and (world"). it should be treated as one single string expression, not two tokens, otherwise "hello will be thought as an operator, but it can not be found from environment.
Below is my test log:
lis.py> "hello world"
Traceback (most recent call last):
File "", line 1, in
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 98, in repl
val = eval(parse(raw_input(prompt)))
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 123, in eval
return env.find(x)[x]
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 89, in find
return self if (var in self) else self.outer.find(var)
AttributeError: 'NoneType' object has no attribute 'find'
The text was updated successfully, but these errors were encountered:
@klose911 has it right -- lis.py does not support the string datatype, only symbols, lists, and numbers, so you shouldn't expect it to parse string literals. lispy.py does support strings.
for example , just input "hello wolrd" after call repl()
"hello world" will be splitted to two tokens like ("hello) and (world"). it should be treated as one single string expression, not two tokens, otherwise "hello will be thought as an operator, but it can not be found from environment.
Below is my test log:
lis.py> "hello world"
Traceback (most recent call last):
File "", line 1, in
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 98, in repl
val = eval(parse(raw_input(prompt)))
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 123, in eval
return env.find(x)[x]
File "/home/klose/Documents/programming/python/intepreter/lis.py", line 89, in find
return self if (var in self) else self.outer.find(var)
AttributeError: 'NoneType' object has no attribute 'find'
The text was updated successfully, but these errors were encountered: