oss project
Project status: stablexpr-lang
A sandboxed expression language with near-byte-identical runtimes in TypeScript, Python, and Go.
3 runtimes 601 conformance tests 71 built-ins
- npm
- @xpr-lang/xpr
- PyPI
- xpr-lang
- Go
- github.com/xpr-lang/xpr-go
- TypeScript
- Python
- Go
- Parser theory
- EBNF
- VitePress
- Vite
- CodeMirror
- Sandboxed expression language with a formal EBNF specification — no I/O, no loops, no side effects — with parsers and evaluators in TypeScript, Python, and Go held near-byte-identical across 601 conformance tests.
- Shipped to npm + PyPI + Go modules with VitePress docs, an interactive playground (Vite + CodeMirror), and 71 built-in functions.
fig. 02
Why I built it
Most expression languages for data pipelines are either too unsafe (full JavaScript with eval), too primitive (cron-style templates), or runtime- specific (you write your pipeline expression once for Python, again for Go). xpr-lang fills the gap: one syntax, three implementations, formal guarantees about safety, and conformance-tested behavior across runtimes.
Architecture highlights
- Single source of truth: the EBNF grammar in
xpr-lang/xpris the authoritative spec. Each runtime parses to the same AST shape. - YAML conformance suite: 601 test cases driving identical behavior across TS/Python/Go, plus 71 built-in functions. CI on every PR.
- Zero I/O surface: no file, network, or OS access; no
import, noeval, no loops. Safe to evaluate untrusted user expressions. - Familiar syntax: arrow functions, pipe operator, optional chaining, destructuring, regex literals — if you know modern JS/Python, you can read xpr-lang.
- Three runtimes: TypeScript (
@xpr-lang/xpr), Python (xpr-lang), Go (github.com/xpr-lang/xpr-go).