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.17k stars 3.28k forks source link

Grammar looks fine in PyCharms ANTLR Preview, but doesn't parse (in Py3 and C#) #3210

Open DerIltis opened 3 years ago

DerIltis commented 3 years ago

Dear all,

I created a grammar for a certain file format withPyCharm and the ANTLR4 plugin. I also "tested" this grammar with PyCharms "ANTLR Preview" feature on files with ~100k lines and everything looks fine. In a simple example, one would get: image

However, whenever I try to manually parse a file with the generated code (both in C# or Py3), I get a different behaviour for some CarriageReturns: line 1:0 mismatched input 'dataset\r' expecting 'dataset'

Unfortunately, the grammar is quite comprehensive and I need some more hours to extract the minimal example from it. However, I also recognized that there have been some differences between C# and JAVA output, as mentioned here:

https://github.com/antlr/antlr4/issues/3112

Could someone of you tell me if 'my' problem could be related to these issues? Would it for example make sense to step back to an older version of ANTLR and the ANTLR runtime, either for the purpose of debugging or to get things working in the first place?

Thank you very much!

ericvergnaud commented 3 years ago

Hi Please move this to the google discussions group

Envoyé de mon iPhone

Le 23 juin 2021 à 06:37, DerIltis @.***> a écrit :

 Dear all,

I created a grammar for a certain file format withPyCharm and the ANTLR4 plugin. I also "tested" this grammar with PyCharms "ANTLR Preview" feature on files with ~100k lines and everything looks fine. In a simple example, one would get:

However, whenever I try to manually parse a file with the generated code (both in C# or Py3), I get a different behaviour for some CarriageReturns: line 1:0 mismatched input 'dataset\r' expecting 'dataset'

Unfortunately, the grammar is quite comprehensive and I need some more hours to extract the minimal example from it. However, I also recognized that there have been some differences between C# and JAVA output, as mentioned here:

3112

Could someone of you tell me if 'my' problem could be related to these issues? Would it for example make sense to step back to an older version of ANTLR and the ANTLR runtime, either for the purpose of debugging or to get things working in the first place?

Thank you very much!

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

DerIltis commented 3 years ago

Hi eric,

Thank you for your hint. I can access the antlr discussion here:

https://groups.google.com/g/antlr-discussion

But how do I post something in there? I have no google account...

With kind regards,

Marcel

KvanTTT commented 3 years ago

Also, you can start a discussion.