Hello everybody,

I'm facing a problem for which it seems I can't find a reply in the site
docs and faqs.

I would like to parse text based on a very simple grammar (arithmetic
expressions with some boolean enhancement). Every example in the site seems
to adopt a non-LLR notation, while I would instead prefer to use
backtrack=false.

In example, I have stuff like this:


protected
expression
    :   (e=conditionalOrExpression -> $e) c=conditionalExpression
    ;

protected
conditionalExpression
    :   QMARK t=expression COMMA f=expression   -> ???
    |
    ;


Where conditionalExpression should possibly substitute the AST element
produced by "expression" with something like

        -> ^(ITE [TheActualASTRoot] $t $f)

in case the first case is matched.

The fact is that I can't find in the site docs how to replace the top of a
parent rule, if at all possible.

Am I completely headed toward the wrong direction?

Giampaolo


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to