Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split error while input string contained whitespace in tokenize function under lis.py #53

Closed
klose911 opened this issue Sep 25, 2018 · 2 comments

Comments

@klose911
Copy link

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'

@klose911
Copy link
Author

Closed - this problem was fixed by lisp.py

@norvig
Copy link
Owner

norvig commented Sep 25, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants