[antlr-interest] conditional processing
Gerald B. Rosenberg
gbr at newtechlaw.com
Mon Nov 26 19:48:52 PST 2007
At 07:02 PM 11/26/2007, Mark Volkmann wrote:
>Part of my AST looks like this.
>
>^('if' condition simpleStatement)
Would help to see the full rule and the condition rule. Still, a
possible solution is to use a semantic predicate, something like:
^('if' b=condition { $b.equals("true") }? simpleStatement)
>In my tree grammar, the rule for "condition" evaluates the matching
>content to true or false. The rule for "simpleStatement" executes the
>statement, for example, it could be a simple print statement. I only
>want simpleStatement to be executed if condition evaluates to true. I
>haven't been able to figure out how to make this work because when
>this part of my AST is matched, the rules for both condition and
>simpleStatement are fired.
>
>I'd appreciate any hints on how to achieve this.
>
>--
>R. Mark Volkmann
>Object Computing, Inc.
----
Gerald B. Rosenberg, Esq.
NewTechLaw
260 Sheridan Ave., Suite 208
Palo Alto, CA 94306-2009
650.325.2100 (office) / 650.703.1724 (cell)
650.325.2107 (facsimile)
www.newtechlaw.com
CONFIDENTIALITY NOTICE: This email message (including any
attachments) is being sent by an attorney, is for the sole use of the
intended recipient, and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
please contact the sender immediately by reply email and delete all
copies of this message and any attachments without retaining a copy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071126/94778da5/attachment.html
More information about the antlr-interest
mailing list