small medium large xlarge

20 Jun 2017, 20:33
Lin Zhang (8 posts)

Dear Professor Parr,

At the end of Section 9.2 Altering and Redirecting ANTLR Error Messages, you show us how to use option -diagnostics, using TestRig via the grun alias. For that example, it generates a two-line output as follows:

❮ line 1:3 reportAttemptingFullContext d=0, input='f();'
   line 1:3 reportAmbiguity d=0: ambigAlts={1, 2}, input='f();'

My questions is on the “d=0” in Line 2. Is this (“d=0”) interpreted as the following: the decision making is in the root rule (counting from 0)? Thank you.



25 Jun 2017, 18:24
Terence Parr (52 posts)

That is the decision number found in the grammar counting from zero. It is statically determined by counting the number of sub rules for example found in the grammar. d=0 does not mean anything about the zeroth rule. For example, the start rule could be “a : b ;” for which there is no decision.

You must be logged in to comment