A dice expression language and evaluator written in Rust, compiling to both a CLI tool and a WASM package for embedding in websites. Supports dice notation (2d6, ^d20, vd20) with full arithmetic expressions, operator precedence, and per-roll statistics (min, max, avg). https://1d20.io
  • Rust 99.1%
  • Shell 0.9%
Find a file
Eve House 06071dc9bb feat: Add Session, eval history, and identifier lexing
- Session struct in lib.rs owns named variable memory (HashMap) and
  eval history (Vec<EvalResult>)
- evaluate() now takes &Session; REPL pushes each result onto history
  after printing
- Lexer recognizes identifiers and keywords: save, no, show
- Expr::Var added to AST for future variable resolution
2026-05-05 17:39:21 -04:00
.zed Partial implementation of the parser 2026-04-30 01:50:57 -04:00
scripts Partial implementation of the parser 2026-04-30 01:50:57 -04:00
src feat: Add Session, eval history, and identifier lexing 2026-05-05 17:39:21 -04:00
.gitignore Initial Commit 2026-04-29 23:09:43 -04:00
Cargo.lock Add evaluator, parser, and REPL 2026-05-01 23:36:25 -04:00
Cargo.toml Add evaluator, parser, and REPL 2026-05-01 23:36:25 -04:00
LICENSE Adding License and README.md file 2026-04-30 02:08:50 -04:00
README.md docs: Update the README.md with usage docs 2026-05-05 00:08:50 -04:00

crabroll

Dice expression evaluator written in Rust. Parses and evaluates standard dice notation with arithmetic, advantage, and disadvantage. Planned WASM build for embedding in websites.

Usage

Run with cargo run. The REPL accepts standard dice notation: 2d6, d20, ^d20 (advantage), vd20 (disadvantage), combined with arithmetic and grouping. Each result shows the rolled value plus theoretical min, max, and average.

> 2d6 + 3
11 (min: 5, max: 15, avg: 10.00)
> ^d20
18 (min: 1, max: 20, avg: 13.83)
> quit

Tests

cargo test