Skip to content

Understating ATN state changes #4370

Answered by kaby76
renatahodovan asked this question in Q&A
Discussion options

You must be logged in to vote

It appears from your output that there are steps missing between NFA 15 to NFA 4. From NFA state 15, input "X", the transitions are NFA 15->16->3->(pop stack)->6->9->7->5->4. The interpreter likely works through this sequence before calling the code to set state number using closure() on the next NFA state. The transitions between 16 and 4 are all empty transitions, less the stack pop, and likely just ends up in NFA state 7. But because the next input is again another "X", and we are in the middle of "start", it's already cached a computed DFA state for rule "start" on "X" from NFA 7, the interpreter goes to NFA 4. The only way to really understand this code is to debug the calls to Adapt…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@renatahodovan
Comment options

@kaby76
Comment options

Answer selected by renatahodovan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants