PythonCompiler
PythonCompiler copied to clipboard
rply.errors.LexingError
specification
python version: 3.10.9 cpu: M1 os: macOS Ventura 13.1 MBA 2020
error
if I run it using the print(1) method it works. but if I try a str print("Hello, World") it gives this error:
rply.errors.LexingError: (None, SourcePosition(idx=0, lineno=1, colno=1))
Full error:
return self.pg.build()
Traceback (most recent call last):
File "/Users/klestiselimaj/Projects/lang/main.py", line 21, in <module>
parser.parse(tokens).eval()
File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/parser.py", line 32, in parse
lookahead = next(tokenizer)
File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/lexer.py", line 62, in __next__
return self.next()
File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/lexer.py", line 58, in next
raise LexingError(None, SourcePosition(
rply.errors.LexingError: (None, SourcePosition(idx=0, lineno=1, colno=1))```
The creator of the repo didn't add support for strings, he only added support for integers and basic mathematical equations. You could add support for them though. One year late...
Happy coding!
Thanks for the reply! I'm making my own parser and lexer in rust now.