PythonCompiler
PythonCompiler copied to clipboard
parsing error for multiple line file code
greeting sir. my name is Aditya Gupta. we have been working a project. and wanted to make a python based compiler. so we started following your blog, which by the way is very helpful. but now we are stack at a point where we have to give an file in input.
input file: in.txt
print(1) print(2)
output obtained for this input:
Token('PRINT', 'print') Token('OPEN_PAREN', '(') Token('NUMBER', '0') Token('SUM', '+') Token('NUMBER', '9') Token('CLOSE_PAREN', ')') Token('PRINT', 'print') Token('OPEN_PAREN', '(') Token('NUMBER', '9') Token('CLOSE_PAREN', ')') Traceback (most recent call last): File "C:\Users\admin\AppData\Local\Programs\Python\Python37\CompNew\check2.py", line 385, in <module> parser.parse(tokens).eval() File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\rply\parser.py", line 65, in parse raise ParsingError(None, lookahead.getsourcepos()) rply.errors.ParsingError: (None, None)
how did you solve your problem?
How can I fix it?
How can I resolve this?
Semicolon was missing in the end of the line.