Grammar looks fine in PyCharms ANTLR Preview, but doesn't parse (in Py3 and C#)
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
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:
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!
Contributor guide
Research direction
Start by reducing the comprehensive grammar to a minimal example that reproduces the carriage-return mismatch in the generated C# or Py3 parser. Compare its behavior with the ANTLR Preview result and the referenced Java/C# differences; done means a reproducible case and a confirmed explanation or fix path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100