Release of re2c lexer generator 2.0

Took place Release re2c 2.0, a free lexical analyzer generator for C and C++. The re2c project was originally created in 1993 by Peter Bamboulis as an experimental generator of very fast lexical analyzers, distinguished from other generators by the speed of generated code and an unusually flexible user interface that allows parsers to be easily and efficiently integrated into an existing codebase. Since then, the project has been developed by the community and continues to be a platform for experimentation and research in the field of formal grammars and state machines.

Major changes:

  • Added support for the Go language (enabled either by the "-lang go" option for re2c, or as a separate re2go program). The documentation for C and Go is generated from the same text, but with different code examples. The code generation subsystem in re2c has been completely redesigned, which should make it easier to support new languages ​​in the future.
  • Added alternative build system on CMake (thanks ligfx!). Attempts to translate re2c to CMake have been made for a long time, but before ligfx, no one offered a complete solution. The old build system on Autotools continues to be supported and used, and there are no plans to abandon it for the foreseeable future (partly to avoid problems for distribution developers, partly because the old build system is more stable and concise than the new one). Both systems are equally continuously tested using Travis CI.
  • Added the ability to specify interface code in configurations when using the generic API (generic API). In the past, most APIs had to be defined in the form of functions or function macros. Now they can be specified in the form of arbitrary strings with named template parameters of the form "@@{name}" or simply "@@" (if there is only one parameter and there is no ambiguity). The API style is set by the re2c:api:style configuration (the functions value specifies the functional style, while the free-form value is arbitrary).
  • Improved operation of the "-c", "--start-conditions" option, which allows combining several interconnected lexers in one re2c block. Now you can use normal blocks as well as conditional blocks and define several unrelated conditional blocks in one file. Improved operation of "-r", "--reuse" (reuse code from one block in other blocks) option in combination with "-c", "--start-conditions" and "-f", "--storable-state" options (a stateful lexer that can be interrupted at an arbitrary point and resumed later).
  • Fixed a bug in the recently added end-of-input processing algorithm (EOF rule), which in rare cases led to incorrect processing of overlapping rules.
  • Simplified bootstrap process. Previously, the build system tried to dynamically find an already built re2c that could be used to rebuild itself. This resulted in incorrect dependencies (since the dependency graph turned out to be dynamic, which most build systems do not like). Now, to rebuild lexers, you need to explicitly configure the build system and set the RE2C_FOR_BUILD variable.

Source: opennet.ru

Add a comment