Documentation

Community

re2c is a free and open-source lexer generator for C and C++.
Its main goal is generating fast lexers: at least as fast as their reasonably optimized hand-coded counterparts.
Instead of using traditional table-driven approach, re2c encodes the generated finite state automata directly in the form of conditional jumps and comparisons.
The resulting programs are faster and often smaller than their table-driven analogues,
and they are much easier to debug and understand.
re2c applies quite a few optimizations in order to speed up and compress the generated code.
Another distinctive feature is its flexible interface: instead of assuming a fixed program template,
re2c lets the programmer write most of the interface code and adapt the generated lexer to any particular environment.

For a step-by-step introduction, see examples.
For complete overview, see the manual.

The best place to report a bug is on github
or in re2c-devel and re2c-general mailing lists.
Note that re2c is hosted on both github
and sourceforge:
github serves as the main repository, bugtracker, and tarball hosting;
sourceforge is used as a backup repository and for mail.

Contributions can come in various forms: bug reports, patches, pull requests, discussion.
A very easy and valuable contribution is adding your lexer to the main re2c test suite
(this is also a good way to make sure that re2c updated will not break your code).
All contributions are welcome!