[antlr-interest] disambiguating semantic predicates
Tom Smith
yotommy at gmail.com
Fri Sep 19 14:22:03 PDT 2008
I am trying to use disambiguating semantic predicates, as I have a
case where "a property of a token must dictate how the parser
interprets it" (to quote The Definitive ANTLR Reference, p. 287). A
snippet of the grammar looks like:
event
:
^(EVENT T1 messageExp (h=hostcode)?)
|
^(EVENT T2 TIMEOUT (h=hostcode)?)
|
^(EVENT T3 varName (h=hostcode)?)
;
T1
:
{ isTypeT1(((Tree) input.LT(1)).getText()) }?
varName
;
T2
:
{ isTypeT2(((Tree) input.LT(1)).getText()) }?
varName
;
T3
:
{ isTypeT3(((Tree) input.LT(1)).getText()) }?
varName
;
varName
More information about the antlr-interest
mailing list