Lexer generation, in Ruby

Write the rules.
Know what wins.

flexr keeps lexer specifications in the language they serve. Define readable rules, inspect every decision, then generate deterministic Ruby for deployment.

One input, four decisions

A match you can read.

source if total == 42
  1. ifIF
  2. totalIDENT
  3. ==EQ
  4. 42INTEGER

/==/ wins over /=/ because the longest match wins.

Why flexr

One specification, from first test to release.

Ruby-native

Use familiar classes, constants, and actions. There is no separate lexer language to learn.

Explainable

Longest match wins. Source order resolves ties. Unsupported patterns surface early.

Ready when you are

Start with one Ruby file.

gem install flexr Read the quick start