[antlr-interest] Antlr 3.0b6 Error Issue (ANTLRWorks 1.0b8)

Bert Williams gilbert.williams at prosync.com
Wed Feb 7 10:01:05 PST 2007


Greetings:

 

After a few download issues, I have successfully installed and run the Antlr
3.0 beta software.

 

This is a great improvement over the 2.7.7 I was previously trying.  At
least I appear to be getting further along.  The automatic left recursion
removal is a very nice feature, especially for someone who doesn't write
grammars every day.

 

 

When I try to run the grammar below (Posix Extended Regular Expressions, a
subset), using the ANTLRWorks 1.0b8 GUI,

I get the following warnings/errors.  I also get occasional internal errors
as shown below.  Whenever I make a change that fails the "Check Grammar"
operation, I seem to get this and other internal errors.

 

My question is:

 

With respect to the warning (200), how does one specify that the parser be
generated?  I really have just one alternative (and I did try e (e)* instead
of (e)+)

Is there a "greedy=false" option?  I don't see anything wrong with the
grammar, but perhaps there is something subtle I am missing.

 

Thanks for your helpful reply.

 

Bert Williams.

 

 

 

------------------------------Warnings/Errors-------------------------------
------------------------------------------------------

 

[12:36:11] error(106): regexshort.g:9:23: reference to undefined rule:
one_character_ERE

[12:36:11] error(106): regexshort.g:9:59: reference to undefined rule:
extended_reg_exp

[12:36:16] Checking Grammar...

[12:36:17] warning(200): regexshort.g:7:37: Decision can match input such as
"<EOT>" using multiple alternatives: 1, 2

As a result, alternative(s) 2 were disabled for that input

[12:36:17] warning(201): regexshort.g:7:37: The following alternatives are
unreachable: 2

 

[12:36:17] warning(208): regexshort.g:136:1: The following token definitions
are unreachable:
ERE_expression,ERE_dupl_symbol,DIGITSET,ALPHASET,ALPHA,DIGIT,COLL_ELEM,PLUS,
DOLLAR,STAR,QUESTION,CARET  

 

 

 

-----------------Antlr Internal
Error-----------------------------------------------------------------------
-------------

 

[12:46:58] error(10):  internal error:
org.antlr.tool.Message.toString(Message.java:124): Assertion failed! Message
ID 106 created but is not present in errorMsgIDs or warningMsgIDs.

 

 

 

--------------------------------------------------------ANTLR 3.0 Grammar
(regexshort.g)----------------------------------------------------

 

grammar regexshort;

 

 

 

extended_reg_exp   : (ERE_branch) ('|' ERE_branch)* (EOF)

                   ;

ERE_branch         : (ERE_expression)+

                   ;

ERE_expression     : (one_character_ERE | '^' | '$' | '(' extended_reg_exp
')') (ERE_dupl_symbol)?

                   ;

one_character_ERE  : ORD_CHAR

                   | QUOTED_CHAR

                   | '.'

                   | bracket_expression

                   ;

ERE_dupl_symbol    : '*'

                   | '+'

                   | '?'

                   | '{' DUP_COUNT               '}'

                   | '{' DUP_COUNT ','           '}'

                   | '{' DUP_COUNT ',' DUP_COUNT '}'

                   ;

DUP_COUNT 

            :           DIGIT ;                   

QUOTED_CHAR

            :           '\\' ORD_CHAR;

 

ORD_CHAR 

            :           COLL_ELEM

            |           DOLLAR

            ;

 

 

bracket_expression : '[' matching_list    ']'

               | '[' nonmatching_list ']'

               ;

matching_list  : bracket_list

               ;

nonmatching_list : '^' bracket_list

               ;

bracket_list   : follow_list

               | follow_list '-'

               ;

follow_list    :  (expression_term) (expression_term)*

               ;

expression_term : single_expression

               | range_expression

               ;

single_expression : end_range

               ;

range_expression : start_range end_range

               | start_range '-'

               ;

start_range    : end_range '-'

               ;

end_range      : COLL_ELEM

//               | collating_symbol

               ;

 

 

 

protected

DIGITSET : '0'..'9' ;

 

protected

ALPHASET :     ('a'..'z'|'A'..'Z' ) ;

 

ALPHA : ALPHASET;

 

DIGIT    : DIGITSET ;

 

COLL_ELEM

      :     ALPHASET

      |     DIGITSET

 

      ;

 

            

 

PLUS

            :           '+'

            ;

            

COMMA

            :           ','

            ;           

 

DOLLAR

            :           '$'

            ;

 

STAR

            :           '*'

            ;

QUESTION

            :           '?'

            ;

LPAREN

            :           '('

            ;           

 

RPAREN

            :           ')'

            ;           

 

ALTERNATION

            :           '|'

            ;

 

LBRACE

            :           '{'

            ;

RBRACE

            :           '}'

            ;           

 

LBRACKET

            :           '['

            ;

            

RBRACKET

            :           ']'

            ;           

 

PERIOD

            :           '.'

            ;

 

DASH

            :           '-'

            ;

BACKSLASH 

            :           '\\'

            ;

 

CARET

            :           '^'

            ;

 

WS       :           ' '

            |           '\t'

            |           '\n'

            |           '\r'

            ;

 

SEMI:   ';'

            ;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070207/86fde051/attachment-0001.html 


More information about the antlr-interest mailing list