[antlr-interest] building ASTs for recursive lists

Lally Singh lally.singh at gmail.com
Wed Nov 17 08:51:35 PST 2004




Hi all, I'm trying to use the OCL grammar to write an interpreter. 
Unfortunately, I'm having trouble converting the grammar into an AST
builder.  I've got clauses like:

logicalExpression
  : relationalExpression
    ( logicalOperator relationalExpression )*
  ;

Where logicalOperator is relatively simple:
logicalOperator
  : "and"
  | "or"
  | "xor"
  | "implies"
  ;

Unfortunately, I can't seem to change logicalExpression to what I'd
like:
logicalExpression
  : relationalExpression
    ( logicalOperator^ relationalExpression )*
  ;

To build a proper tree.  Why can't I? Or even better? How can I?

Thanks for your time,

-Lally








 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list