Rust Rewrite Index

flex

fast lexical analyzer generator

Rust efforts

Research record · 2026-11-29

Searched GNU flex/lex Rust source ports, compatible .l generators, lrlex and OpenLexer. Found independent compatible alternatives, not a direct Rust translation of flex in these sources. Generating Rust code with flex or a lexer is not itself a port.

Original source check. The packaged source scan found zero files with the .rs suffix. This covers the Debian 13 snapshot and excludes common vendor directories. Independent repositories are outside this count.

Rust alternative

OpenLexer

Rust lexer/parser generator accepting Flex-style specifications. It documents no %option directives, REJECT, yymore/yyless or multiple buffers; full flex compatibility is not established.

Evidence checked 2026-11-29
Rust alternative

lrlex

Rust lexer generator described as a partial lex/flex replacement, with Rust-oriented output rather than a complete flex port.

Evidence checked 2026-11-29

Project structure

Flex is a tool for generating scanners: programs which recognized lexical patterns in text. It reads the given input files for a description of a scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates as output a C source file, lex.yy.c, which defines a routine yylex(). This file is compiled and linked with the -lfl library to produce an executable. When the executable is run, it analyzes its input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding C code.

Inside the source tree

  • tests/ · 118 indexed files
  • po/ · 60 indexed files
  • examples/ · 49 indexed files
  • src/ · 41 indexed files
  • m4/ · 15 indexed files

Source files by extension in this snapshot · C (35), C++ (1)

Selected components packaged from this source in Debian 13.

  • flex · fast lexical analyzer generator
  • libfl2 · SHARED library for flex (a fast lexical analyzer generator)
  • flex-doc · Documentation for flex (a fast lexical analyzer generator)
  • libfl-dev · static library for flex (a fast lexical analyzer generator)