[antlr-interest] C generator is not generating @after actions
Gavin Lambert
antlr at mirality.co.nz
Fri Feb 6 19:05:31 PST 2009
At 05:05 7/02/2009, Jim Idle wrote:
>All my experience tells me that I will be answering "How do I
>make this go faster forever though". It is better require a
>request for debug 'style' information/instrumentation, in
>the way the C compilers do.
That's what FAQs are for :) (You're going to get this sort of
question either way -- and "how do I make it faster" is an easier
question to answer than "why does this mysteriously fail on
certain input".)
Possibly though we're just coming at this from different
perspectives. Performance has never really been a big issue for
me, as most of the ANTLR grammars I've created have been used
either in hobby projects where I didn't really care about the time
required (even though these probably ended up having the largest
amount of input pumped through them at a time) or as DSL compilers
for professional projects where the overall non-ANTLR compile-time
was in the minutes anyway so a few more seconds here or there
didn't really make much difference.
Getting the grammars robust, though, was at times quite
un-obvious, especially when I was first starting out.
>#define ANTLR3_SANITY_CHECK
>
>But otherwise that would do it assuming that I wanted to add
lots
>of #ifdefs. It is however easy to extend the debug option,
>assuming that Ter believes the idea is a worthwhile one.
I still think the default should be to sanity check. (Similar to
how most people work on their projects in "debug mode" and only
switch to "release mode" for final testing and release.) And this
is quite a different idea than ANTLR's current debug mode.
You also wouldn't need all that many #ifdefs -- just one or two at
the top of the file where you create a bunch of macros that either
compile to sanity-checking code or to nothing. It's a pity you
can't rely on being compiled with gcc, though, since that compiler
has extensions that make doing this sort of thing much easier :)
More information about the antlr-interest
mailing list