Lex
Menu
lex

A typed, lazy expression and declaration language.

One grammar, one parser, and one bytecode evaluator for interactive lines and pure declarative files, with checked physical units, strict overrides, and canonical formatting.

let
  base = { host = "cache.modus.systems", memory = 64 MiB, timeout = 250 ms },
  cfg  = base with { memory = base.memory + 512 KiB }
in
  [cfg.host, "${cfg.memory}", "${cfg.timeout}"] |> join_text(" · ")
=>"cache.modus.systems · 66048 KiB · 250 ms"

Build from source

Pre-1.0. Source is on GitHub.

nix develop
odin run tools/lextool -collection:lex=src -- build
./build/lex eval -e '1 MiB + 512 KiB'

For agents

Point your coding agent at the evaluator-verified SKILL.md before writing or editing Lex expressions and .lex files.

Read https://lex.modus.systems/SKILL.md before writing or editing Lex code or .lex files. Follow its syntax, unit, and strict `with` rules, and verify files with `lex fmt --check`, `lex lint`, and `lex eval`.