[antlr-interest] funny things with the generated C target

Jim Idle jimi at temporal-wave.com
Thu Jul 17 09:30:01 PDT 2008


On Thu, 2008-07-17 at 16:33 +0800, Davyd Madeley wrote:

> On Thu, 2008-07-17 at 01:24 -0700, Jim Idle wrote:
> > On Thu, 2008-07-17 at 15:53 +0800, Davyd Madeley wrote:
> > >         tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT,
> > >                         lexer);
> > >         if (!tokens)
> > >         {
> > >                 fprintf (stderr, "ERROR: could not generate token
> > > stream\n");
> > >                 exit (1);
> > >         }
> > 
> > Please consult the examples and API documentation and turn up the
> > warning levels on your compiler. The input to the token stream is not
> > the lexer, but the lexer token set.
> > 
> > tokens = antlr3CommonTokenStreamSourceNew (ANTLR3_SIZE_HINT,
> > TOKENSOURCE(lexer));
> > 
> > (Note that TOKENSOURCE is for Antlr 3.1 and above, which you should
> > probably use now.
> 
> Aah, I'm using version 3.0.1 of the C runtime, which explains why this
> symbol wasn't present. I thought that was strange, but took it out and
> then forgot to chase up what I should be using instead.
> 
> I can't locate the 3.1 runtime. Where should I be looking?


I would make this an FAQ but one of the main FAQ's seems to be "how do I
find the FAQ" as it is all over the Wiki ;-):

On the main ANTLR web page, you will see the section "Documentation".
There you will find "ANTLR API Documentation", under that link you will
find "C API". On the front page of this, you will see "Building from
Source"

To get the distribution, either download the source package from the
ANTLR Downloads page - linked from ANTLR main page (look for Snapshot
releases if you want the latest beta). Or if you want to use Fisheye go
to:

http://fisheye2.atlassian.com/browse/antlr/runtime/C/dist/

The link to the name is the link to the revision history, not the
download, to download, click on the, err, Download icon. This is
admittedly tiny and I think a lot of people have a problem spotting it,
but under the REV column, there is a downward pointing arrow ICON. Hover
over it and it says "Download".

Also, take note of the Search box in the middle of the main ANTLR page,
where typing "C download" yields this page in the WIki as the first
link:

http://www.antlr.org/wiki/display/ANTLR3/Using+the+ANTLR3+C+Target

There, there is a heading "Finding the source code", where it gives all
of this information in excruciating detail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080717/509aa0c0/attachment-0001.html 


More information about the antlr-interest mailing list