Addition of unrelated, unused parser rule to grammar causes different parsing results
See original GitHub issueThis is related to a SO question https://stackoverflow.com/q/73522066/4779853
The grammar is poorly written as an EOF-start rule, but that is irrelevant because parsing results should always be consistent when a completely unrelated, unused parser rule is added or deleted. Therefore there is something wrong in the runtime.
grammar my;
st: 'H' hd | EOF ;
hd: 'D' d | 'C' c | st ;
d: hd ;
c: 'D' c | hd ;
s1: 'D' s1 | c ;
// p: hd ;
SKP: [ \t\r\n]+ -> skip;
Input
H C D C C D
Commented rule p
causes parser to work one way, uncomment rule p
works another way. It is illogical for a rule that is unused to influence a parse because it’s never used in a derivation. It must be investigated.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
java - Unused parser rule is causing an error, depending on ...
1 Answer 1 ... The problem is that you are indirectly declaring a lexer rule matching \n\n by using '\n\n' in a parser...
Read more >A Guide To Parsing: Algorithms And Terminology
An in-depth coverage of parsing terminology an issues, together with an explanation for each one of the major algorithms and when to use...
Read more >parsing-using-combos.. - Department of Computer Science
In combinator parsing, the text of parsers resembles BNF notation. We ... a result value and the unused suffix of the input string....
Read more >Learning for Semantic Parsing Using Statistical Machine ...
The parsing model is based on the synchronous context-free grammar, where each rule maps a natural-language substring to its meaning representation.
Read more >0bf55623237c869dd9603386c6...
LL(1) grammars, Greibach Normal Form (GNF) induced grammar structure, and the induction of Arithmetic PEG's. LL(1) to GNF based grammar. Keywords—Parsing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some good news.
I’d rather we focus on larger issues than grammar warnings that I might find too risky to merge. Maybe help with antlr4-lab?