[antlr-interest] Re: ANTLR and guarded predicates
lgcraymer
lgc at mail1.jpl.nasa.gov
Wed Mar 20 11:02:38 PST 2002
--- In antlr-interest at y..., mzukowski at b... wrote:
> I don't have time to look into why it's not working right now, but
you could
> certainly get by with a subrule:
>
> production: (syntax guard)=>({semantic test}? another_production)
> | some_other_production
> ;
>
> Also note that PCCTS properly hoisted predicates into calling rules.
ANTLR
> does not, you will have to manually hoist the rule yourself, like I
did with
> the typedef rule in the GCC grammar.
>
> Monty
ANTLR attaches sempreds to subrules (explicit or implied) internally,
so Monty's solution should work properly. Fixing the internals
without breaking something else might be difficult: as Ric has
mentioned in other emails, ANTLR's internal "tree" (custom,
unfortunately, not AST-based) structure is messy to deal with and
needs a redesign/rewrite.
--Loring
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list