antlr / antlr/antlr3

Validating a script with more OR and AND Conditions inside one IF Loop takes a while to complete.

Open
#137 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
253
Forks
178
PR merge metrics
No merged PRs in 30d

Description

Hi,
Please I am running an issue with this case. I have a script that I am trying to save to the database, but before saving I need to validate the grammar of the rule with ANTLR. The issue is that its taking a while to parse the script below;

"

```
IF ((result1 = "Y" AND result2 = "Y") OR (result1 = "Y" AND result3 = "Y") OR
(result1 = "Y" AND result4 = "Y") OR (result1 = "Y" AND result5 = "Y") OR
(result1 = "Y" AND result6 = "Y") OR (result2 = "Y" AND result3 = "Y") OR
(result2 = "Y" AND result4 = "Y") OR (result2 = "Y" AND result5 = "Y") OR
(result2 = "Y" AND result6 = "Y") OR (result3 = "Y" AND result4 = "Y") OR
(result3 = "Y" AND result5 = "Y") OR (result3 = "Y" AND result6 = "Y") OR
(result4 = "Y" AND result5 = "Y") OR (result4 = "Y" AND result6 = "Y") OR
(result5 = "Y" AND result6 = "Y") )
RETURN true
```

"
I can't specify exactly a number of OR?AND from what it started to failed but when debugging the number was fluctuating between 14 and 22.
Its looks like its a limitations of the ANTLR, but not quite sure.
Please is somebody experience this issue before or could somebody provide me some insight on how to resolve this?
Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied IF expression and reproduce the parse-time fluctuation while recording the ANTLR version, grammar, and runtime configuration. Done means identifying whether the delay is caused by the grammar or parser setup and documenting a concrete, reproducible resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.