Hi all, I am trying to use semantic predicates in ANTLR for the following grammar rule
test[n]
:({n==0}? => ~('a'))
|({n==1}? => ~('b'))
|({n==2}? => ~('c'))
;
However, ANTLR does not let me define the grammar in such a way, requiring that at least one of the alternatives be default. The exact error displayed is a reference error, for the parameter n.
My aim is that I want one, and only one of the alternative to be visible at any given instant of time. Any ideas as to how to go about doing this?
Thanks!