[antlr-interest] Debugging tree parser antlr 2.7.5
Neeraj Joshi
jneeraj at us.ibm.com
Mon Jan 22 06:33:15 PST 2007
Hi All,
I am new to antlr so please pardon my ignorance.
I am writing a tree parser for my grammar. When I run the parser I get a
bunch of exceptions like
<AST>:0:0: unexpected end of subtree
How do I debug this? I have added genHashLines = true; to both the
regular parser as well as the tree parser, however I still get <AST>:0:0
How can I pinpoint the exact location where the problem is?
When I do an antlr.Tool on my tree parser input file I get a
non-determinism warning however as far as I understand antlr is handling
it correctly
Here is the snippet
identPrimary :
collectExpr
| IDENT (
(IDENT)?
( arrayIndex
|
#(
METHOD_CALL (exprList)?
)
)?
)
;
collectExpr
:
#(COLLECT_OP #(METHOD_CALL (exprList)?) (arrayIndex
(methodPropArrForCollect)? )? );
The non determinism occurs in identPrimary because
collectExpr requires "collect" as the first symbol while the 2nd
alternative can be any identifier except "collect". The way the
productions are ordered it seems it would resolve the ambiguity correctly
(collect is a special type of a method)
Does the non-determinism have anything to do with the unexpected end of
subtree?
Any help would be greatly appreciated
Thanks!
Neeraj
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"'In the end, everything is fine. If it is not, it is not the end"
Neeraj Joshi
Staff Software Engineer
Autonomic Computing Division
(919)543-5298
TIE: 441-5298
Ext: 3-5298
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070122/d059f02c/attachment.html
More information about the antlr-interest
mailing list