[antlr-interest] Semantic predicates during AST construction
Oliver B. Fischer
o.b.fischer at gmx.de
Mon Oct 6 00:30:29 PDT 2008
Jim Idle schrieb:
>> It isn't clear what you are asking for - that post is from 2005.
>
>> Do you mean you want to know how to use semantic predicates, or that you
>> want to know how to conditionally create one type of tree over another:
>
>> { predicate1 }? -> ^(THIS)
>> { predicate2 }? -> ^(OR THAT)
>> -> ELSE
>
I know this syntax and I am using it already. But now I would like to
know if it is possible to use semantic predicates to control the
construction of specific parts of the tree?
I would like to express things like:
-> ^(ROOT A ({condition}? B | C)
Evaluates condition to true, I would like to get ^(ROOT A B). Otherwise
the result should be ^(ROOT A C).
Bye
Oliver
--
Oliver B. Fischer, Schönhauser Allee 64, 10437 Berlin
Tel. +49 30 44793251, Mobil: +49 178 7903538
Mail: o.b.fischer at gmx.de Blog: http://www.sw-blog.net
More information about the antlr-interest
mailing list