[antlr-interest] Debugging help please
Edward Batutis
edward at batutis.com
Sun Sep 20 15:29:10 PDT 2009
Hi,
I started using ANTLR yesterday. I created my first grammar file via
ANTLRWorks. Everything was fine for awhile, then after typing about
600 lines of code I noticed that there was an error in the syntax
diagram pane:
"Cannot display rule "xxx" because start state not found"
The syntax highlighting in the editor didn't show any errors. So, I
pressed Ctl-R ('check grammar') which reported "check grammar
succeeded". So, I selected "Generate/Show Parser Code". This
complained about an exception which I have copied from the console
pane:
-----------pane contents-------------
[18:19:42] Checking Grammar...
[18:20:02] error(10): internal error: Exception SMF.g:410:9:
expecting '>', found
'p'@org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347):
unexpected stream error from parsing SMF.g
[18:20:02] error(150): grammar file SMF.g has no rules
[18:20:02] error(100): SMF.g:0:0: syntax error: assign.types:
<AST>:0:0: unexpected end of subtree
[18:20:02] error(100): SMF.g:0:0: syntax error: define: <AST>:0:0:
unexpected end of subtree
[18:20:02] error(10): internal error: Exception SMF.g:410:9:
expecting '>', found
'p'@org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347):
unexpected stream error from parsing SMF.g
[18:20:02] error(150): grammar file SMF.g has no rules
[18:20:02] error(100): SMF.g:0:0: syntax error: assign.types:
<AST>:0:0: unexpected end of subtree
[18:20:02] error(100): SMF.g:0:0: syntax error: define: <AST>:0:0:
unexpected end of subtree
[18:20:02] error(10): internal error: Exception C:\SMF.g:410:9:
expecting '>', found
'p'@org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347):
unexpected stream error from parsing C:\Documents and
Settings\ebatutis\My Documents\Contracts\netapp2\SMF.g
[18:20:02] error(150): grammar file C:\SMF.g has no rules
[18:20:02] error(100): C:\SMF.g:0:0: syntax error: assign.types:
<AST>:0:0: unexpected end of subtree
[18:20:02] error(100): C:\SMF.g:0:0: syntax error: define: <AST>:0:0:
unexpected end of subtree
[18:20:02] error(100): C:\SMF.g:0:0: syntax error: antlr.print:
<AST>:0:0: unexpected end of subtree
-----------pane contents-------------
Note that it is "expecting '>', found 'p'. Well, this syntax error is
inside a quoted string
tableWritePrivilege
:
'write-privilege'
(ATTRIBUTES_PRIVILEGE)
'{'
fieldNameList
'}'
;
If I remove that line then it complains about syntax errors inside
other literal strings later on in the file. If I forgot a quote
somewhere I can't find it.
My question: how do I debug this? I found a page listing various
switches and I've added them to the switch options in ANTLRWorks but
they don't seem to help.
Suggestions?
Thanks,
=Ed
More information about the antlr-interest
mailing list