peter at tortall.net
Fri Jan 2 15:34:00 PST 2004
The primary change we did to re2c was to do a C++ -> C conversion, which
I'd expect is something you probably don't want. There are, however, two
major added features/bugfixes you'll probably want to incorporate into the
re2c mainline source:
1) #line output corrections. The mainline re2c output leaves a lot to be
desired with this; things like gdb debugging do not work correctly with
re2c-generated code (the actions code and re2c-generated code have poorly
mixed line numbers--see the mainline scanner.c for example). We fixed
this in the yasm branch of re2c; the re2c files that changed to correctly
generate the #lines are code.c, main.c, parse.h, dfa.c, globals.h,
scanner.re/scanner.c, and substr.c. The essential part of this is to keep
track of an extra "oline" variable that tells the various parts of code
the current line number of the output file to generate #lines for it
appropriately (to avoid line number overlaps).
2) re2c's own scanner (scanner.re/scanner.c) was not catching EOF's
properly, so if an EOF was encountered in an unexpected spot in the input,
the re2c scanner would crash. See the rev 1.10->1.11 change of
One other change which you might like to incorporate: we removed the
uint/uchar/ushort/ulong typedefs to avoid compiler warnings on Linux (a
system header defines them).
You might also want to look at our yasm/tools/re2c/cleanup.pl script,
which does post-processing on the re2c output to remove unreferenced
labels and unused yyaccept variables. It's not perfect (it can be
confused by comments, etc), so it's not something you'd necessarily want
to use by default, but it would probably be nice to include in the re2c
distribution for others to use if they desire.
I'll certainly sign up to sending you a diff for the above changes for you
from the yasm CVS tree (e.g. from the C version), but I may not have the
time to apply and test them against the C++ re2c mainline.
Hopefully you're interested in some of the above changes; we've found them
useful--we hope others will as well. I'll work on getting the diffs
together and send them to you soon.
On Fri, 2 Jan 2004, Dan Nuffer wrote:
> Hi, while googling for re2c, I noticed that yasm has a copy of re2c in
> your CVS, and it appears as peter has made some changes to it as well.
> I've recently taken ownership of re2c and am hosting it on Sourceforge.
> Basically the point of this message is so that I can get an idea about
> the changes you've made so I can determine if it's worth bringing them
> back into the mainline source. If you could let me know what you've
> done, that would be greatly appreciated and would save me from digging
> through your CVS logs :-)
More information about the yasm-devel