jevitha wrote:
When you do things like that in the parser, the equivalent tree grammar will be quite different in structure as $postfixExpression does not make much sense (you have already built the tree. I suspect, that looking at your grammar here you have followed the normative spec for a language too closely and so are finding it awkward to build the tree in a natural way. What language are you trying to parse? That said though, all you need do is the following: 1) Identify all the nodes that can start the rewritten tree node: CALL, INDEX, FIELDACCESS, primary 2) Construct the recursive tree rule that reflects this. You will have something like this: pE : ^(CALL pE args) | ^(INDEX pE args) | ^(FIELDACCESS pE args) | primary ; I think though that you probably need to rework that grammar rule a bit though. It might look more natural using the ^ operators or you might need '.' postFixExpression. Sometimes the way you have this set up is the way to do it; without the whole grammar it is difficult to tell :-) Jim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~--- |
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address