[antlr-interest] More, Status of C++ backend?

Gavin Lambert antlr at mirality.co.nz
Wed Jan 2 14:49:24 PST 2008


At 05:22 3/01/2008, Jim Idle wrote:
 >Yeah - I see that argument too, however I think it will end up
 >being slower just for the sake of making it use "proper
 >classes", so I would not use it and just go with the C runtime.

There's nothing inherently slow about C++ over C, it's just that 
you have to be aware that the compiler can inject extra code 
"behind your back" :)

And I wasn't proposing going and using std::string as a member of 
the token or anything.  You'd do it the same way as the Java 
runtime works -- normally store only indexes, but create a string 
on demand.

 >I think doing this in phases makes a lot of sense.

Definitely.  The obvious first phase would be to get the C runtime 
C++-safe (which last time I checked it almost was, there was just 
one function somewhere that used a C++ keyword as an identifier, I 
think).  The second phase would be to make C++ wrappers for the 
existing C runtime.

The thing is, I'm not convinced that making C++ wrapper classes 
would actually be faster or simpler than making full C++ 
classes.  Trying to take a C++ object (with polymorphic methods) 
and pass it across to the C runtime could get a little 
tricky.  Doable, of course; I'm just not sure it's worth the 
effort.



More information about the antlr-interest mailing list