[antlr-interest] Tree grammars with output=AST and generating problem

Johannes Luber jaluber at gmx.de
Thu Mar 20 09:52:39 PDT 2008


Thomas Karcher schrieb:
> Hi,
> 
>> last working build was in January, though, if you still want to try it.
> 
> Thanks, Johannes, for that hint - with the January version, it seems to
> work ...
> 
> But I got another problem that I'm not sure if it is my mistake or a
> bug:
> 
> I have a lexer/parser grammar with CSharp AST output like
> 
> start:	rule1
> rule:	rule2*
> rule2:	TOKEN1 rule3 TOKEN2 -> rule3
> ...
> 
> which I generate with ANTLRWorks 1.2b1.
> 
> Unfortunately, the parser crashes with an
> Antlr.Runtime.Tree.RewriteEmptyStreamException. I debugged the generated
> parser code a bit and found something out: For the AST generation, a
> variable named root_0 is initialized with null. During rule processing,
> this future root node of the returned AST is not properly filled ... not
> even with the nil node. If I fix this by hand, the parser works.
> Is this an issue that you know about? I'd be glad to help you debugging
> if necessary.

I haven't seen this bug yet. Can you create a minimal grammar exhibiting 
the bug and what to do about?

Johannes


More information about the antlr-interest mailing list