small medium large xlarge

12 Apr 2017, 16:33
Terence Parr (52 posts)

Hi. The idea is just that if you get an error at token index 46 and then you get a second error at token index 46, you have an infinite loop. To avoid this, it forces consumption of a token.

12 Apr 2017, 16:37
Lin Zhang (8 posts)

Dear Terence,

I’m reading Chapter 9 of this book (version P1.0). In p. 168, you wrote, “If we reach the same parser location and have the same input position, the parser forces a token consumption before attempting recovery.” And then in p. 170, using a test run of Simple.g4, you mentioned this principle again: “During recovery for this second error, the parser trips the fail-safe because it has arrived at the same parser location and input position.”

Can you please, using the test run of Simple.g4, explain to me what you really mean by saying “the same parser location” and “the same input position”? My guess is: “the same parser location” is member, and “the same input position” is int, in this example. Am I correct?

Thank you for your time and help!



You must be logged in to comment