marcelogdeandrade / PythonCompiler

Code used on "Writing your own programming language and compiler with Python" post
GNU General Public License v3.0
234 stars 53 forks source link

parsing error for multiple line file code #4

Open aditya9126 opened 5 years ago

aditya9126 commented 5 years ago

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

gabbrieu commented 3 years ago

how did you solve your problem?

InsaneMiner commented 3 years ago

How can I fix it?

alf1e commented 2 years ago

How can I resolve this?

depeshpo commented 2 years ago

Semicolon was missing in the end of the line.