[antlr-interest] Re: Get AST info of a previos treeparser
francislustman
francislustman at yahoo.fr
Fri Sep 3 04:14:00 PDT 2004
I have the exact same pb (and I have just posted it before seeing this
post) so let me elaborate a little :
In TreeParser1, I build a tree t containing a custom node NODE with
attribute attr.
Now in TreeParser 2 parsing t, I match NODE with rule
rule_treeparser2 : #(NODE other_rule)
{ cout << #rule_treeparser2->attr ;}
;
If buildAST = true, antlr generates a copy of the original node but
attr is not initialised. The call made to astFactory->create does not
initialize the extra attributes, only Type and Text.
If BuildAST = false, attr is there but as the original message says,
that is not what we want.
--- In antlr-interest at yahoogroups.com, "David Ryan" <oobles at h...> wrote:
>
> I'm not sure exactly where your problem is, but it could hae to do
> with mismatching tokens?
>
> I recently did a multiple pass Tree parser over XML using XPA. To
> make sure all the Tree Parsers would work together I imported the
> Token types from the first pass into my subsequent passes.
>
> options
> {
> buildAST = true;
> importVocab = Step1Pass;
> }
>
> I was able to perform 9 phases, with some phases being passed multiple
> times.
>
> Hope that helps,
> David.
>
> --- In antlr-interest at yahoogroups.com, Joan Pujol <joanpujol at g...>
wrote:
> > Hi,
> >
> > I'm doing the semantic control using several phases: TreeParser1,
> TreeParser2.
> > And I have a problem trying to get info from TreeParser1 with
> TreeParser2.
> >
> > For example I have the rule:
> > root: #(ROOT a1 a2 a3)
> >
> > If I use buildAST=false I can use the info from the previos AST with
> #root.
> > Because in sourece code #root resolves to root_AST_in.
> >
> > But if I use buildAST=true (what I need) #root is resolved to root_AST
> > that it's null.
> > How can I access the root_AST_in when I have buildAST=true? Because in
> > the code exist, but I don't know how to get the value.
> >
> > Cheers,
> >
> > --
> > Joan Jesús Pujol Espinar
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