antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.11k stars 3.28k forks source link

Python runtime incorrectly handles epsilon productions at <EOF> #2879

Open BinaryAura opened 4 years ago

BinaryAura commented 4 years ago

For the Python target Grammars with possible epsilon productions at the end of the input ('') yields "no viable alternative at input ''"

The input for attached grammar and main is: "hello()\r\n" HW1.zip

The above error should only be thrown when the grammar expects a token (which epsilon productions do not) and the only remaining token is ''

ericvergnaud commented 4 years ago

Hi Are you seeing a different behavior with other runtimes?

Envoyé de mon iPhone

Le 14 août 2020 à 21:53, Johnathan Dunker notifications@github.com a écrit :

 For the Python target Grammars with possible epsilon productions at the end of the input ('') yields "no viable alternative at input ''"

The input for attached grammar and main is: "hello()\r\n" HW1.zip

The above error should only be thrown when the grammar expects a token (which epsilon productions do not) and the only remaining token is ''

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.