[Question] Why is the ATN of the following lexer rules different from the javadoc of ATNState
See original GitHub issueI have the following toy lexer
fragment DIGIT
: [0-9]
;
NaturalNumber
: DIGIT+
;
According to the javadoc of ATNState, the ATN of NaturalNumber
should start with RuleStartState --> PlusBlockStartState
.
But In fact, a path in the ATN looks similar to
RuleStartState -> BasicState -> SetTransition[0-9] ->RuleStopState -> BlockEndState
^ |
| |
BasicState <---------------------- PlusBlockStartState <- ... <- PlusLoopbackState
Could someone advise why the ATN is changed in this way, and is it possible to get a canonical
ATN as described in the javadoc of ATNState
?
Thanks in advance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Why is the ATN of the following lexer rules different from the ...
Could someone advise why the ATN is changed in this way, and is it possible to get a `canonical` ATN as described in...
Read more >LexerATNSimulator (ANTLR 4 Runtime 4.7 API) - Javadoc.io
When we hit an accept state in either the DFA or the ATN, we have to notify the character stream to start buffering...
Read more >Package org.antlr.v4.runtime.atn
Represents a single action which can be executed following the successful match of a lexer rule. Class Summary. Class, Description. AbstractPredicateTransition.
Read more >Lexical Analysis with ANTLR
Lexical Analysis with ANTLR. A lexer (often called a scanner) breaks up an input stream of characters into vocabulary symbols for a parser,...
Read more >Initialising my Lexer throws an error in Antlr4 - Stack Overflow
It sounds like there might be a version issue. ANTLR generates serialized ATN (augmented transition networks) that have a special format ...
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
It seems like it would be better to convert this to a GitHub discussion instead of moving it to a completely different medium.
So, for the lexer rule
NaturalNumber
, there will be noRuleStopState
which has no outgoing transitions.