[antlr-interest] Re: SQL grammar tree construction problem

Joshua Davis joshua.davis at kiodex.com
Fri Nov 7 05:01:17 PST 2003


ANTLR newbie question:

I've been having a similar problem I think.  I made a very simple 
grammar based on L. V.'s grammar.   It seems to be always producing 
only one root node, with no children.  What steps should I take to 
debug this?  I have tried adding actions to the rules, and it looks 
like the rules are being triggered correctly, but no AST is produced.

--- In antlr-interest at yahoogroups.com, "lgcraymer" <lgc at m...> wrote:
> Gustav--
> 
> You cannot make a rule a root--that's what ANTLR is complaining 
about. 
>  Rules may represent subtrees, so only nodes with token ids (TEXT 
or 
> STRING, for example) can be followed with ^.
> 
> --Loring
> 
> 
> --- In antlr-interest at yahoogroups.com, Gustav Boström 
<i93gusbo at h...> 
> wrote:
> > Hello!
> > 
> > I'm trying to use Lubos Vnuk's (Thanks for doing all the work!) 
SQL-
> > grammar in order to do some 
> > processing on SQL-statments. I would for example like to find out 
> > which columns are affected by a DML-statement and which 
parameters 
> > correspond to which columns.
> > 
> > I'm doing this is in Java , so I've changed the grammar slightly.
> > I've removed the C++ actions or replaced them with Java versions.
> > 
> > My thought was to add AST-construction and then navigate the tree 
to 
> > find out the stuff I need. This is where I run into problems.
> > I tried to annotate the rules with ^ to construct my tree, but it 
> > keeps giving me "unexpected token:^" when I try to dothis for 
> example:
> > sql_stmt : 
> > 	  sql_data_stmt^ 
> > ;
> > 
> > I've set the options to buildAST=true;
> > I'm using version 2.7.2.
> > 
> > Any ideas on what can be wrong?
> > 
> > Cheers,
> > 
> > Gustav Boström


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list