Hello All,

I'm more or less a newbie using antlr. I have a small issue on creating
the AST, using rewrite rules. I'm so sorry if this is a FAQ or similar! :)

I have the following productions (it's like an algebra with
3 operators with different priorities):

        
targetsExpr  : (category) ('CAND' targetsExpr)*
   ->^('CAND' category targetsExpr*)
 ;
category: (matchEl) ('OR' category)*
   -> ^('OR' matchEl category* )
 ;
matchEl : factor ('AND' factor)* ->^('AND' factor*)
 ;

factor
 : matchId OPAR targetValue COMMA targetName CPAR ->^('FAC' matchId
targetValue targetName)


The problem is that the AST created contains productions as:

CAND ->OR -> OR-> AND (FAC, FAC).

The second OR is created because the ``category'' production is passed
multiple times.

Is there a way to not create these kind of  rules?

You can see a sample of the AST created in
http://www.mascanc.net/~max/policy.pdf.



-- 
Massimiliano Masi

http://www.mascanc.net/~max

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