antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.12k stars 3.69k forks source link

CPP14.g4 grammar takes long time parsing this class #1050

Open skelter opened 6 years ago

skelter commented 6 years ago

The CPP14.g4 grammar gets bogged down parsing the attached ProblemDemo.h file. Add the 5th parameter and it will run longer than a day.

ProblemDemoh.txt

Antlr version: 4.7.1 Target language: Java Language being parsed: C++ Java JDK version used: 1.8 Grammar: cpp14.g4

suehshtri commented 6 years ago

runs longer than 9.3 days, but it does actually finish.

skelter commented 5 years ago

Looks like this grammar now fails instead of getting bogged down. As of dc44383e2 I don't see a run-away, but instead get a "no viable alternative".

I have some test files in a branch 'templatetorment' at https://github.com/skelter/grammars-v4/tree/templatetorment

Marti2203 commented 3 years ago

Hi, I am currently looking into it. The main issue is in the formal parameters. I will make a PR to fix it.