[antlr-interest] Composed grammars and AST, pb with .h files; and "Bus error" with 'toStringTree'

Jim Idle jimi at temporal-wave.com
Wed Jul 30 08:07:55 PDT 2008


On Wed, 2008-07-30 at 15:55 +0200, Jean-Claude Durand wrote:

> I get a pb easy to fix when I use composed grammars with AST: the .h
> files include 
> 
> each other (because of forward references) and do not compile. Here is
> a very simple example
> (I am using Version 3.1b2, and C target language):
> 


>    input        = antlr3AsciiFileStreamNew(fName);
>    if ( (ANTLR3_UINT64)input < 0 )
>    {
>                 switch((ANTLR3_UINT64)input)
>                 {
>                         case    ANTLR3_ERR_NOMEM:
>                         fprintf(stderr, "Unable to open file %s due to
> malloc() failure1\n", 
>                                                                 (char
> *)fName);


Please note that with 3.1, the return codes from all the functions are
either NULL (indicating failure to allocate memory), or a valid pointer,
hence the testing for <0 and so on is no longer necessary or valid. See
the drivers main.c in the 3.1 examples for details. 

Jim
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080730/d127bcf7/attachment.html 


More information about the antlr-interest mailing list