[antlr-interest] unexpected end of subtree
Ric Klaren
klaren at cs.utwente.nl
Mon Jun 28 05:45:35 PDT 2004
Hi,
On Mon, Jun 28, 2004 at 04:32:03AM -0700, Mr Torsten Curdt wrote:
> > parse(ROOT)
> > instruction(INSTRUCTION)
> > literal(Format)
> < literal(PARAMETER)
> > literal(5.1)
> < literal(null)
> > literal(null)
> <AST>:0:0: unexpected end of subtree
> < literal(<ASTNULL>)
> < instruction(INSTRUCTION)
> > instruction(INSTRUCTION)
> > literal(Application)
> < literal(PARAMETER)
> > literal(somepackage)
> < literal(null)
> > literal(null)
> <AST>:0:0: unexpected end of subtree
> < literal(<ASTNULL>)
> < instruction(INSTRUCTION)
> > instruction(INSTRUCTION)
> ...
>
> For the following grammar:
>
> instruction
> : #(INSTRUCTION inst=literal
> (#(PARAMETER kn=literal kv=literal))+
By the look of the trace the kv literal is missing in your trees.... I find
it helpfull for debugging this stuff to put a custom error handler on the
rule giving trouble with a toStringList() on the #rule_in tree. That way
you can directly see the structure of the input to the rule.
> Hm.. but looking at the trace output
> it seems like the treeparser is exspecting
> literals, but gets nulls instead. ...which
> is because of the ()+ closure. And unfortunately
> it complains about it.
My guess is that you've forgotten something when building the tree for the
parameter part. The trace only shows PARAMETER and the 'kn'-literal. So it
does not even get to do a loop for the ()+ closure.
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755 ----
-----+++++*****************************************************+++++++++-------
"Never argue with an idiot, for they will bring you down to their
level and beat you with experience." --- Unknown
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list