[antlr-interest] error in tree grammar - regd.

Jim Idle jimi at temporal-wave.com
Wed Jul 9 20:39:48 PDT 2008


On Wed, 2008-07-09 at 21:53 -0500, ASHOK REDDY wrote:

> Hello,
> 
> I am trying to debug the following tree grammar when I antlr
> complained with the following message:- 
> 
> Message in the console:- 
> 
> [21:44:50] Checking Grammar...
> [21:44:50] error(10):  internal error:
> org.antlr.tool.Message.toString(Message.java:124): Assertion failed!
> Message ID 138 created but is not present in errorMsgIDs or
> warningMsgIDs. 
> 
> Message in the pop-up window:
> 
> (138): DOTTREE.g:0:0: grammar DOTTREE: no start rule (no rule can
> obviously be followed by EOF)
> 
> Attached in the tree grammar file.


Ah, A dot grammar :-)

This is fairly simple to fix, if just using ANTLR 3.1 does not sort it
out. In the grammar that produces this tree, if you have not got a start
rule that ends in EOF, create one:

translationUnit
    : graph   EOF

        ->^(TRANSUNIT graph)
    :

Then make program be whatever your current start rule is (the one that
produces DIGRAPH or GRAPH).

In your tree grammar, have

translationUnit
    :    ^(TRANSUNIT
             graph
           )
   ;

basically it just cannot work out where your grammar is supposed to
start. That should do it.

Jim    



> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080709/64a45996/attachment.html 


More information about the antlr-interest mailing list