Generation
Generation turns a .flexr.rb specification into Ruby source. The generated lexer keeps rule actions as Ruby code, so review the specification and generated artifact as executable code.
bundle exec flexr check lexer.flexr.rbbundle exec flexr generate lexer.flexr.rb -o lexer.rbThe generator supports the longest-match table, direct, and auto backends. Select backend :firstmatch explicitly to use the first matching rule in definition order. This backend is stable and requires no experimental option.
Runtime dependencies
Section titled “Runtime dependencies”| Mode | Build-time dependency | Runtime dependency |
|---|---|---|
| Runtime | flexr | flexr |
| Generated | generator and flexr | usually flexr |
| Standalone generated | generator and flexr | generated file only |
Use standalone output only when the generated file is verified and the deployment boundary requires no runtime gem. Confirm the generated file does not load the runtime before publishing it.
Reproducible artifacts
Section titled “Reproducible artifacts”Treat the generator version, Ruby version, backend, encoding, and Unicode data snapshot as part of the artifact contract. If generated Ruby is committed, regenerate it in CI and fail on a diff.
See runtime vs generated and the repository’s generated artifact reference.