[antlr-interest] Re: TreeParser doubt
cintyram
cintyram at yahoo.com
Tue Mar 11 09:03:38 PST 2003
Sorry for replying to my own post!!
To avoid the problme cited below, i included the rules in rule2 in
rule1 ;
but pretty soon it will becom every complex;
so i hope some one will help me by suggesting what to do;
cheers
ram
--- In antlr-interest at yahoogroups.com, "cintyram" <cintyram at y...> wrote:
> hi,
> i had a tree parser lilke this ..
>
>
> rule1 : # ( ID ID rule2 ) ;
> rule2 : # ( ASSIGN ID ( COMMA ID )* ) ;
>
> but because i have to extract the values of the matched text,
> into the data structures in the main program i modified the rules as
> follows ..
>
> rule1
> [
> std::string & name ,
> std::string & value ,
> std::vector<std::string> & list
> ]
> : #( nam:ID {name = nam->getText() ; }
> val:ID {value = nam->getText() ; }
> { rule2(list) ; }
> ) /// wrong code .. tule2 shud get the tree it should mtch ..
> ;
> rule2
> [
> std::vector<std::string> & list
> ]
> : # ( ASSIGN i:ID{list.push_back(i->getText() );}
> ( COMMA id:ID {list.push_back(id->getText() );}
> )*
> )
> ;
>
>
> as stated in the comment, rule2 has to be passed the tree it is
> supposed to match, if used as a function ..
> so what should i do now?
> Thanks in advance
> cheers
> ram
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list