EMLib is a research-oriented TypeScript monorepo built around the operator
inspired by All elementary functions from a single binary operator by Andrzej Odrzywolek.
This repository turns the paper into a reusable TypeScript library, a Bun + React playground, and a small documentation set for contributors.
- Repository: TokenFlow-chat/emlib
- Demo: eml.tokenflow.chat
packages/emlib: parsing, analysis, lowering, rewriting, evaluation, JSON graph serialization, and experimental search/training utilities for elementary expressionssrc/: a browser playground for exploring standard ASTs, pure EML forms, 3D force-directed expression graphs, and selected experimentsdocs/: implementation notes and a local copy of the reference paper
The repository is optimized for local Bun workflows, and README claims are intentionally limited to behavior implemented in code and covered by tests.
bun install
bun run devTo build production assets:
bun run buildStatic output is written to dist/.
bun run dev # local dev server with HMR
bun run start # run the app in production mode
bun run build # build the static site to dist/
bun run test # run Bun tests across the workspace
bun run fmt # format with oxfmt
bun run fmt:check # verify formatting
bun run lint # run oxlint
bun run typecheck # tsgo typecheck + emlib build
bun run check # lint + typecheck + test + buildimport {
analyzeExpr,
evaluate,
evaluateLossless,
parse,
reduceTokens,
serializeExpr,
toPureEml,
toString,
valueToExpr,
} from "emlib";
const expr = parse("exp(x) - ln(y)");
console.log(analyzeExpr(expr));
console.log(toString(toPureEml(expr)));
console.log(toString(reduceTokens(expr)));
console.log(evaluate(expr, { x: 0.5, y: 2 }));
console.log(toString(valueToExpr(evaluateLossless(parse("(1 + 2*i) / (3 - 4*i)")))));
console.log(serializeExpr(expr));For syntax support, API details, and behavior notes, see packages/emlib/README.md.
Issues and pull requests are welcome.
- Install dependencies with
bun install. - Run
bun run checkbefore opening a pull request. - Keep README and docs changes aligned with current code and tests.
- Be explicit about whether a change affects mathematical semantics, library APIs, playground behavior, or documentation.
- Add or update tests when changing lowering, rewriting, evaluation, synthesis, or training behavior.
- Paper title: All elementary functions from a single binary operator
- arXiv entry: 2603.21852
This repository is licensed under the Apache License 2.0.