[antlr-interest] ANTLR ANTLR Grammar

Jim Idle jimi at temporal-wave.com
Fri Sep 17 09:07:27 PDT 2010


That is out of date a bit now - we have new parsers for ANTLR 4 that start
with reference grammars so that everyone has a start point.

For now though I think that you can ignore those as the ambig is OK and the
lexer rule is because they are imaginary I think.

Jim 

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Zachary Palmer
Sent: Thursday, September 16, 2010 5:09 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR ANTLR Grammar

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

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list