[antlr-interest] ANTLR + C Target Questions

Michael Coupland mcoupland at gmail.com
Fri Apr 24 13:20:03 PDT 2009


> root: letter* EOF;
>
> No exceptions in C so that top rule can only set flags.

That change to the grammar works great, thanks! For reference, what
would I want to look at if I wanted to deduce what portion of the
input data the parser had consumed?


> Maybe, but as free is a function in every C runtime that I know of,
> #defining it in a system header file would break a lot more than the
> ANTLR runtime. Which system are you thinking of that #defines free? The
> trade off is the use of an intuitive method name vs something like
> 'release' or 'close'.

It's definitely a rarity, and something that you have to be very
careful about, but many performance-sensitive codebases do ugly/sneaky
things to hijack control of memory allocations throughout the system.
I know of at least one high-profile commercial game engine that
#defines free to be something else, and the MySQL SDK does this as
well. I understand the argument for intuitive names, but wouldn't
something like freeObject be equally intuitive, and less likely to
collide?


> The docs at: http://antlr.org/api/C/index.html document
> displayRecognitionError which, just like in Java, is what you must
> override to implement your own error display.

Ok, thanks. I had noticed displayRecognitionError, but wanted to make
sure there wasn't some other error-handling mechanism that I needed to
worry about as well.

I think it would be helpful if there were a brief mention of this
function on the front page of the C API - something as simple as "If
you want to hook a custom error handler, override
<link>displayRecognitionError</link>." (There is no instance of the
string "error" on that main page, which was the first thing I tried
searching for...)

(Also, as an aisde, the link to "displayRecognitionError" on
http://antlr.org/api/C/antlr3exception_8h.html appears broken.)


> It is download rather than downloads. From hudson just click on the
> project. The first thing that comes up is a list of source code
> artifacts that you can download???
>
> http://antlr.org/hudson/job/ANTLR%20C%20Runtime/

http://antlr.org/download looks very useful! Is there a link to this
page from the main ANTLR webpage? Most download links seem to point to
http://antlr.org/download.html , which is different...

For the C Runtime, yes, it's pretty easy to find the download in
Hudson, but I didn't know where to go in Hudson to get the specific
file you mentioned in the other email (
antlr-master-3.1.4-SNAPSHOT-completejar.jar )  - it's not 100% clear
which Hudson job it would belong to (probably ANTLR_Tool, though), and
there don't appear to be any downloadable artifacts at
http://antlr.org/hudson/job/ANTLR_Tool/

Thanks for your response, it was very helpful!


Michael


More information about the antlr-interest mailing list