[antlr-interest] Re: Putting this all into an AST
lgcraymer
lgc at mail1.jpl.nasa.gov
Fri Mar 5 13:49:40 PST 2004
Sorry--
Change this to
( ( WORD DOT^)? (WORD DOT)* )? n:name! ...
My original factoring put <name> as a child of the DOT tree.
Mostly, think through how things should look in a tree, separate out subrules as rules if necessary to structure the tree, and proceed.
--Loring
--- In antlr-interest at yahoogroups.com, "offline314159" <offline at s...> wrote:
> As Loring suggested, i refactored groups to read like this:
>
> w:WORD ( DOT^ WORD ( DOT! WORD )* )?
>
> So when i get a single point group, there's just that one word as the
> root.
> "grpword"
> ---- (name)
> --------(params)
> --------(value)
>
> But, when i get more than one subgroup, i get problems - the group
> tokens all vanish, and in the AST i get
> "."
> ---- (name)
> -------(params)
> -------(value)
>
> But it loses the rest of the group, which is not desired behaviour.
> And it doesn't seem to make sense, based on the shape of the rule for
> groups
>
> So, i'm wondering, do i have to manually build the group tree? And if
> so, how do i do it with that rule? This is going to require actions,
> i can see that, but i'm not totally sure about the right ones to take
> (as should be obvious to the list in general at this point.)
>
> --- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> > Remember, only tokens, not rules, can be made into a root. So {#item =
> > #([groups, ""], #item);} makes no sense because "groups" is a rule.
> ANTLR
> > isn't smart enough to know if the rule "groups" only returns a
> single token.
> > And I don't know because you didn't post the groups rule. So more
> detail is
> > needed to help you.
> >
> > Monty
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