[antlr-interest] antlr3 C-Target ever used in reality?

Jim Idle jimi at temporal-wave.com
Sat Nov 29 09:52:20 PST 2008


On Sat, 2008-11-29 at 14:06 +0100, Christian Hoffmann wrote:

> What's wrong below????
> antlr error:  reference to rewrite element unaryExpression1 without reference on left of ->
> 
> 
> unaryExpression1     // (level 1)
>   : a=INC        -> ^(TOK_PREINC[$a]) unaryExpression1
>   | a=DEC        -> ^(TOK_PREDEC[$a]) unaryExpression1
>   | unaryExpression2
>   ;
> 
> rewriting rules doesn't work, if you write something like:
> rule : expr -> ^(TOK_SLIST (statement)*)
>             { pVMCompiler->m_Symbols.PopScope(); }
>      ;
> cause C-Target code results in:
>       ADAPTOR->addChild(ADAPTOR, root_0,  pVMCompiler->m_Symbols.PopScope(); );
>                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> the inlined code is inside the addChild(...) call
> 
> 
> It seems the c-target is developped without beeing used in reality.
> I'll go back to antlr2, at this stage, antlr3 is nonviable...
> 


I think that you are just running into things that you do not quite
understand yet, but it is true that I don't know of anyone trying to use
a backtracking C parser and produce tree output. backtrack mode really
isn't for a production parser.

In this case, you just don't understand the syntax, and what you think
is action code is being included in the rewrite syntax.  This is nothing
to do with the C target, it would do similar things with all targets.
You need to execute your action before the rewrite, or put the grammar
in '(' ')'.

Jim

PS: It doesn't hurt to be a little less acerbic with your comments,
especially when you later find out that the problem is with your own
understanding :-)

> 
> ---
> Christian Hoffmann
> D-38118 Braunschweig
> 
> 
> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081129/518d6366/attachment.html 


More information about the antlr-interest mailing list