re2c is a free and open-source lexer generator for C/C++, Go and Rust with a focus on generating fast code. It compiles regular expression specifications to deterministic finite automata and encodes them in the form of conditional jumps in the target language. This approach is generally faster than table-based lexers, and the generated code is easier to debug and understand. A flexible user interface allows one to adapt the generated lexer to a particular environment and input model, avoiding the overhead on unnecessary checks and buffers. re2c is based on the lookahead TDFA algorithm that allows it to perform fast and lightweight submatch extraction. It is used in other open-source projects such as php, ninja, yasm, spamassassin, BRL-CAD, wake, etc.
Subscribe to receive the latest news and updates. See the user manuals (C/C++, Go, Rust) for a complete overview with examples.