[antlr-interest] Example projects for C output

Jim Idle jimi at temporal-wave.com
Tue Apr 17 23:23:23 PDT 2007


I have added a VS2005 .sln to the examples folder in the ANTLR source
tree. This currently includes:

 

C parser example, with examples of using global dynamic scopes and ANTLR
runtime supplied hash tables for symbol tracking (now finally fixed for
those who were waiting for this - sorry for delay, but alimony to pay J)

Dynamic scope example - small example of using a rule scope for tracking
embedded methods;

 

In progress, may be done by the time you read this:

 

Fuzzy java grammar.

 

To follow:

 

All the rest of the examples that do not use java based string templates
(needs some thought on that I think - I might use JNI or something to
make it work, though it would be dependant on Java).

 

 

To use the examples, you must first build or install the ANTLR3 C
runtime - the .sln and projects assume that they are built relative to
the ANTLR tree, but you will be able to work out how to change the
project configurations easily enough - at runtime, the .dlls must be in
your PATH somewhere.

 

Although the examples are configured using Visual Studio 2005, there is
no reliance on Windows for the actual examples. In *NIX  then all you
need do is run the ANTLR tool on the .g3pl files (suffix is optional but
makes visual studio custom rules files (see .rules file in source tree
under lib/C/vs2005/rulefiles) easier to manage with those suffixes,
though I may change these to be nearer the more usually accepted
suffices for grammar files. The output will be 4 (usually) files, being
2 .c files and 2 .h files. Tree examples will produce slightly different
files. Then, gcc (or your compiler) the .c files, with -I. and -I
path/to/antlr/includes and -L path/to/antlr/libs -lantlr3c{d}. You will
need to set LIBPATH/LD_LIBRARY_PATH/SHLIB_PATH according to the whims of
your system.

 

Each examples comes with a main.c that shows you how to construct the
input streams and so on, then call the parsers.

 

Tarball should update in FishEye (see ANTLR3 home page) shortly.

 

I think that for the C target there is only the following outstanding:

 

1)      Make memorization work - not a big job, I just forgot to do it;

2)      Simplify provision of hints for small, medium, large, huge input
files (saves on memory if you need to do that);

3)      Re-profile and memory check with Devpartner Studio (I wish
Compuware would let me have the Windows Vista beta so I don't have to
configure a Virtual machine!!!)

4)      Review all bug fixes by Ter to make sure they made it to C
target;

5)      Incorporate template changes to move lexer rule code from
generated code into the token stream 'class' and therefore reduce size
of generated code;

6)      Fix outstanding C target bugs (only a few);

 

So, this should be ready for release by the end of this month, along
with the Java target, ANTLR3 1.0 (or whatever Ter calls it) and Peter
Jones as The Book;

 

Don't Panic,

 

Jim

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


More information about the antlr-interest mailing list