PythonCompiler icon indicating copy to clipboard operation
PythonCompiler copied to clipboard

parsing error for multiple line file code

Open aditya9126 opened this issue 5 years ago • 4 comments

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)

in.txt

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)

error.txt

aditya9126 avatar May 27 '19 06:05 aditya9126

how did you solve your problem?

gabbrieu avatar Dec 16 '20 17:12 gabbrieu

How can I fix it?

InsaneMiner avatar Apr 25 '21 06:04 InsaneMiner

How can I resolve this?

alf1e avatar Mar 27 '22 17:03 alf1e

Semicolon was missing in the end of the line.

depeshpo avatar Jun 12 '22 05:06 depeshpo