[antlr-interest] ANTLR ANTLR Grammar

Zachary Palmer zep_antlr at bahj.com
Thu Sep 16 17:09:17 PDT 2010


Hello all,

I just tried to use the ANTLR grammar for ANTLR v3 which appears here: 
http://www.antlr.org/grammar/ANTLR

I tried building it in ANTLR v3.1.3 and got the following messages:

warning(105): /resources/grammar/ANTLRv3.g:93:9: no lexer rule 
corresponding to token: DOC_COMMENT
  |---> :   DOC_COMMENT?

warning(105): /resources/grammar/ANTLRv3.g:248:6: no lexer rule 
corresponding to token: SEMPRED
  |---> |   SEMPRED ( g='=>' -> GATED_SEMPRED[$g] | -> SEMPRED )

warning(105): /resources/grammar/ANTLRv3.g:157:4: no lexer rule 
corresponding to token: DOC_COMMENT
  |---> :    DOC_COMMENT?

warning(105): /resources/grammar/ANTLRv3.g:354:22: no lexer rule 
corresponding to token: SEMPRED
  |---> :    (rew+='->' preds+=SEMPRED predicated+=rewrite_alternative)*

warning(200): /resources/grammar/ANTLRv3.g:472:5: Decision can match 
input such as "' ''$''A''N''T''L''R'' ''s''r''c'' ''"''\\''\'''"'' 
''0'..'9'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
  |---> (    ' $ANTLR ' SRC // src directive

I looked through the grammar and the messages seem to be correct: 
DOC_COMMENT is defined as a special token and not as a lexical 
terminal.  Anyone have any suggestions as to what I should do about 
this?  I want to write some utilities to analyze the grammar I've 
written and doing so by walking over an AST of the grammar seemed to be 
the most promising choice.

Thanks,

Zach


More information about the antlr-interest mailing list