i’m having an error showing :
line 1:5 mismatched input '<EOF>' expecting NEWLINE
for my input :
print "hi"
I’m basically new to ANTLR so I really don’t have any idea on what this error is about? I do get that I should have an End-of-File, but how should I place it?
It means the parser stumbles upon the end of the file, while it expects a line break. To fix it, simply place a line break at the end of your input.
This means you have something like this in your grammar:
making the
NEWLINEmandatory just before theEOF. You could also do something like this:making
NEWLINEoptional at the end, but mandatory betweenstatements.