> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> > So first, here is your grammar rewritten without anything but
> standard rewrite rules (lexer skipped and compressed for space). You
> can see that this is somewhat, err... 'simpler' ;-)
> Unfortunately, the stripped down grammar you propose is completely
> inequivalent to mine (and mine was a stripped down version of the much
> more complicated version in my real program, in which I have multiple
> alternatives and cases and decisions on what type of tree to create).
Produces the same tree ;-). But really the point was to highlight that there is
nothing wrong with the stream and that a simple example shows you how to do the
tree building yourself.
>
> Your code results in:
>
> tree = (TIER (WORD a (PHO 0)) (WORD b (PHO 1)) (WORD c (PHO 2)) (WORD d
> (PHO 3)))
> Exception in thread "main"
> org.antlr.runtime.tree.RewriteCardinalityException: token d
> at
> org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElemen
> tStream.java:165)
> so it behaves nothing like my production code.
Well, I said you needed to do conditional rewrites right? When they imbalance
the rewrite streams will throw exceptions, which is all that is happening here.
>
> So I think the right thing for me to do is to study the generated code
> for rewrites and mimic the use of the adaptor APIs to link up the
> trees correctly.
Yes - this is what I was getting at basically.
Jim
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
-~----------~----~----~----~------~----~------~--~---