[antlr-interest] Oracle 7 Sql Grammar - any actual workingconfigurations ?

Nigel Sheridan-Smith nbsherid at secsme.org.au
Tue Jan 18 14:32:52 PST 2005



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Philip Dye
> Sent: Wednesday, 19 January 2005 8:06 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Oracle 7 Sql Grammar - any actual
> workingconfigurations ?
> 
> with either version 2.7.2 or 2.7.4 of the antlr.jar file results in a long
> list of grammar errors.
> 

Hi Phillip,

Non-determinisms are just warnings - the parser/lexer that is generated will
be greedy and consume input in one particular way when it has a number of
alternatives to choose between.

For example, if my tokens are "IDENT NUMBER NUMBER" and I have to choose
between the rules (with, "k", the lookahead equal to 1 or 2):

options: option1 | option2;
protected option1: IDENT NUMBER IDENT;
protected option2: IDENT NUMBER NUMBER;


Then the parser will not be able to work out what alternative to choose. In
this case, I think it more or less assumes that the first option is the way
to go and tries that alternative.

Whilst non-determinisms are not ideal, it least try out the generated
parser/lexer with some test input and see if it does what you expect. In
most cases, it will only be obscure input that trips the problem. When you
are more familiar with ANTLR and the grammar, a lot of these
non-determinisms can be weeded out with syntactic (or semantic) predicates.

Cheers

Nigel



--
Nigel Sheridan-Smith
PhD research student

Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435




More information about the antlr-interest mailing list