
Dan Nuffer wrote:
It is possible to use re2c generated code in a c++ context. However, to explain the current situation, the original re2c c++ lexer was actually written in pure C (thus the origin of the aq_* code), and it looks like Hartmut has only changed the minimum necessary to integrate it with Wave. Like he said, if it works, don't mess with it :-)
Yes, I've written minimal interfacing code only. Nevertheless I had to change the lexer itself (mainly the token regex's) quite a bit.
I originally wrote the re2c c++ scanner as a benchmarking tool to compare performance of re2c/flex/SLex generated scanners. At the time re2c won by about a factor of 2 IIRC. I did it in C because my #1 goal was performance. I found it interesting that, using the exact same source, if I compiled it as C instead of C++, it was about 10% faster. But that was years ago with gcc 2.95.2, who knows how things would stand today?
I haven't obversed such a runtime difference during my tests, but what I do have observed is a significant compile time difference in about factor 10 and more (between the compilation of the re2c generated giant switch statement with a C and a C++ compiler). Regards Hartmut