[antlr-interest] C target broken?

Heinrich du Toit heinrich at silasvalley.com
Thu Sep 25 08:43:57 PDT 2008


I'm also having problems with C target.. but I think you can solve this 
with specifying ASTLabelType.

e.g.
grammar Cee;

options{
 
    backtrack   = true;

    language    = C;
    output    = AST;

    ASTLabelType= pANTLR3_BASE_TREE;   
}

I'm still having other problems with C target :(
atleast it seems to work better than the python target which doesn't 
even generate successfully inside antlrworks :(





Florent Teichteil wrote:
> Hi,
>
> After 1 month working on an other project, I am trying to recompile an
> ANTLR3.1 project. My grammar was generated using ANTLR 3.1b2, but the
> corresponding C target is no more available. Then, I install
> libantlr3c-3.1 : the C target runtime library is not compatible with
> the code generated using ANTLR 3.1b2 !
>
> As a result, I regenerate my grammar with ANTLR 3.1, but the generated
> code does not compile because "tree" variables in C structures are not
> declared:
>
> // BEGIN OF CODE
>
> typedef struct ppddlParser_ppddlDoc_return_struct
> {
>     /** Generic return elements for ANTLR3 rules that are not in tree
> parsers or returning trees
>      */
>     pANTLR3_COMMON_TOKEN    start;
>     pANTLR3_COMMON_TOKEN    stop;
>     	tree;                                                  // ERROR HERE!
>
> }
>     ppddlParser_ppddlDoc_return;
>
> // END OF CODE
>
> I tried both ANTLRworks and ANTLR IDE v3 for eclipse, without success...
> In other words, it seems the code generator and the C runtime library
> provided on ANTLR website are not compatible.
> Which version of ANTLR and of the C runtime library should I use?
>
> By the way, based on my own experience, it is often quite difficult to
> find the C target runtime library whose version corresponds to the
> right version of ANTLR that generated the C code. Would there be a
> clearer way to associate the versions of the code generator and of the
> runtime libraries?
>
> Best,
> Florent
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>   



More information about the antlr-interest mailing list