Ibex is a Pure Ruby LR parser generator. It reads racc-compatible grammar
files, generates parsers with the familiar do_parse / yyparse API, and
requires no native extension.
The shortest path is the Getting Started guide: install the gem, try the calculator grammar, and then choose the compatible or extended contract you need. You can also inspect a grammar in the browser without uploading its source.
Ibex is pre-1.0. The v1.0 publication decision is on hold pending an independent review of the published error-experience evidence; feature development continues. The default compatible mode and its current IR contracts are the conservative adoption baseline. See the release status and stability policy for the human-readable boundaries.
R001: HOLD — awaiting_independent_review.
The current whole-library steep stats result is 29,778 typed calls and 2,906 untyped calls out of 32,724 (91.0% typed).
The generated signature tree contains 506 explicit untyped occurrences across 41 files.
Add the generator to an application or tool project:
gem install ibex
# or, in a Gemfile:
bundle add ibexApplications that only run generated parsers can depend on the smaller runtime:
bundle add ibex-runtimeSave this as calculator.y:
class Calculator
token NUM
preclow
left '+'
left '*'
prechigh
rule
expr : expr '+' expr { result = val[0] + val[2] }
| expr '*' expr { result = val[0] * val[2] }
| NUM { result = val[0] }
end
---- inner
def parse_tokens(tokens)
@tokens = tokens
do_parse
end
def next_token
@tokens.shift
end
---- footer
if $PROGRAM_NAME == __FILE__
tokens = [[:NUM, 2], ['+', nil], [:NUM, 3], ['*', nil], [:NUM, 4]]
puts Calculator.new.parse_tokens(tokens)
end
Generate and run it:
ibex -o calculator.rb calculator.y
ruby calculator.rb
# 14The generated parser uses compact immutable tables and depends on
ibex-runtime. Use -E when a single self-contained generated file is more
convenient. Use --check in CI to detect stale generated output.
| Surface | Use it for | Maturity |
|---|---|---|
| Compatible mode | Existing racc grammars and conservative migrations | Stable baseline |
| Extended mode | EBNF, imports, generated lexers, trees, types, and tooling | Preview; explicit opt-in |
ibex impact |
Grammar propagation, automaton, action metadata, and coverage review | Preview; read-only |
| Browser playground and incremental CST sessions | Local analysis and evaluation | Preview/Experimental; bounded |
The default frontend remains unchanged unless a grammar opts into
pragma extended or the command line uses --mode=extended. Read the
grammar reference,
racc migration guide, and
maturity audit before adopting a
Preview or Experimental surface.
Use ibex impact to review where a changed nonterminal can
propagate. Its reports are deterministic and read-only; nullable boundaries and
source-only action references remain explicit limitations.
IELR is also explicit: --algorithm=ielr uses the conservative partition
strategy by default, while --ielr-strategy=direct enables the experimental
LR(0)-based construction. Direct IELR is profiled and reviewable, but it is not
the default release strategy; see the IELR guide.
Static frontend, formatting, documentation, LSP, IR, verification, and browser analysis treat grammar actions and user sections as opaque source. Generated parsers and semantic parses execute application Ruby and are not sandboxes. The playground runs in a local Web Worker, does not upload grammar source, and never executes parser actions or user-code sections. Its limits and non-goals are documented in the playground guide.
- Documentation hub — task-oriented entry points.
- Grammar gallery — executable examples with declared tests.
- API reference — generated Ruby API documentation.
- Configuration model — grammar-owned and invocation-owned settings.
- Project status and evidence — release, roadmap, and bounded claims.
- Contributing and security reporting — community workflow.
Clone the repository only when you need to contribute or run the complete quality suite:
git clone https://github.com/ydah/ibex.git
cd ibex
bundle install
bundle exec rake
npm ci
npm run test:siteThe development guide lists the focused frontend, type, evidence, browser, and workflow checks.
The public reference also indexes the direct IELR decision, direct multi-entry decision, verifier trust boundary, and the error-experience review status. These records scope claims to their evidence and revision; they do not change the compatible installation path above.
Ibex is available under the MIT License.