-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing in 4.1 goes into an infinite loop, runs in 4.0 #374
Comments
Hi. Confirmed that it's slow. It uses full context parsing and the preds slow it down. Standard two-stage parse finishing right away.
I'll close but will keep in mind this known issue. |
Thanks for the reply, especially the code for doing the two stage parsing. Hi. Confirmed that it's slow. It uses full context parsing and the preds public static void main(String[] args) throws Exception {
I'll close but will keep in mind this known issue. — |
Could someone explain this pattern? Starting a "stage two" of something in a catch block seem arcane. What's going on? |
Hi. The need for the two-stage optimization is explained in detail here: http://www.antlr.org/papers/allstar-techreport.pdf |
Please see the release notes for ANTLR 4.2. One-stage parsing of grammars like yours was specifically addressed. |
…. Note, now ChemistrySentenceParserTest is down to 2.065 from 10.028 sec. Thanks Dan for the suggestion.
When parsing a complex equation (500+ elements) with a default order of precedence, the 4.1 parse() method goes into an infinite loop. If the precedence is forced using parenthesis, the parsing completes very quickly. When parsed with 4.0, it does complete (albeit incredibly much longer than with parenthesis, 600+ times slower - 52 seconds versus 0.080 seconds).
When running with 4.1, the trace output never proceeds beyond:
Grammar
Input test file
The text was updated successfully, but these errors were encountered: