Hello everybody,

I'm trying to write a parser for sql92 and I have some trouble with the 
tables in the from-clause, especially with the joins within it. I'd like 
to solve the ambiguities caused by the recursion in this case. I read 
the "Definitive ANTLR Reference" and now i'm wondering if my problem is 
something like the "if-then-else ambiguity" mentioned in chapter 11 
(p.275) and I can just ignore the warning.
If not, how can I solve the ambiguity? I'm happy about any clue.

The grammar (the mentioned part) is attached for better understanding :)

Thanks in advance,

Matthias
-- 
Matthias Kiehl


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

grammar test;

test    :       table_ref;

table_ref
        :       table_ref_simple ((CROSS_JOIN table_ref) | qualified_join)*
        ;

table_ref_simple
        :       (qualified_name | LPAREN (table_ref | select_stmt) RPAREN) (AS? 
ID (LPAREN column_name_list RPAREN)?)?
        ;

qualified_join
        : NATURAL JOIN table_ref
        | (INNER | (LEFT | RIGHT | FULL) OUTER?)? JOIN table_ref join_spec
        ;

join_spec 
        : ON search_condition
        | USING LPAREN column_name_list RPAREN
        ;

column_name_list
        :       ID (',' ID)*
        ;

qualified_name  
        :       ID ('.' ID)*
        ;

search_condition
        :       ;

select_stmt 
        :       ;

LPAREN  :       '(';
RPAREN  :       ')';
AS      :       'as';
NATURAL :       'natural';
INNER   :       'inner';
LEFT    :       'left';
RIGHT   :       'right';
FULL    :       'full';
OUTER   :       'outer';
UNION   :       'union';
JOIN    :       'join';
ON      :       'on';
USING   :       'using';

CROSS_JOIN
        :       'cross' ' '+ 'join'
        ;

ID
        :       (SINGLE_LATIN_LETTER | INT) (SINGLE_LATIN_LETTER | INT | '_')*
        ;
        
fragment
SINGLE_LATIN_LETTER
        :       'a'..'z'
        |       'A'..'Z'
        ;

fragment        
INT     :       '0'..'9';

WS      :       (' ' | '\t' | '\n' | '\r')+ {$channel = HIDDEN;} ;
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to