[antlr-interest] error in my rule...

Trey Spiva Trey.Spiva at embarcadero.com
Wed Dec 11 06:29:31 PST 2002



> Could you help me to understand what is wrong in my rule:
> 
> query!
> 	:SELECT! a:selection_list
>              {## = #([QUERY, "query"], #(SELECT, a));}
>          (WHERE! b:where_list
>              {## = #([QUERY, "query"], #(SELECT, a),#(WHERE, b));})?
> 	;
> 
> As output I want to get an AST of the form:
> 	#(QUERY #(SELECT a) #(WHERE b)), where
> 	QUERY is imaginary note and WHERE is optional.
> 
> How could I rewrite this rule?

I believe that the AST declaration should be:

query!
	:SELECT! a:selection_list (WHERE! b:where_list )?

      {#query = #(#[QUERY, "QUERY"],
                  #([SELECT, "SELECT"], a),
                  #([WHERE, "WHERE"], b));
	;

 

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



More information about the antlr-interest mailing list