[antlr-interest] ANTLR 3.0b6 Code Generation Issue

Jim Idle jimi at intersystems.com
Mon Feb 12 11:00:48 PST 2007


While you may have stumbled on a code generation issue, there are a
couple of questions about your grammar:

 

Did you mean your grammar to read:

 

character_class :

                | CCE_ALNUM        

                | CCE_ALPHA  

...

 

Or:

 

character_class : CCE_ALNUM        

                | CCE_ALPHA  

...

 

Similarly:

 

end_range      : range_chars

                 character_class

               | collating_symbol

;               

 

Or

 

end_range      : range_chars

               | character_class

               | collating_symbol

;               

 

Also, it looks like this:

 

expression_term : end_range //single_expression

                | range_expression

                ;

 

range_expression : start_range end_range

                 | start_range '-'

                 ;

 

start_range      : end_range '-'

                 ;

 

Could possibly be just:

 

expression_term  : end_range ('-' (end_range)? )? ;

 

Use actions rather than ambiguous rules to decide what pieces you have?
That said You may be trying to achieve something different ;-)

 

Jim

 

 

 

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Bert Williams
Sent: Monday, February 12, 2007 10:16 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR 3.0b6 Code Generation Issue

 

If I remove the comment at line 130 of the attached grammar file,
ANTLR3.0b6 generates code with the following types of errors:

*	"eregexParser.java": LA12_2 is already defined in
expression_term() at line 1052, column 25 

The error does not occur if the line is commented out.

 

No ANTLR error is generated with either grammar.

 

What's causing this?  Is there a workaround?

 

Bert Williams.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070212/ec30cea5/attachment.html 


More information about the antlr-interest mailing list