@creationix/rex
v0.4.1
Published
Compiler and parser for the Rex language
Maintainers
Readme
@creationix/rex
Rex compiler and parser package.
Install
bun add -g @creationix/rexPublish to npm
From packages/rex-lang:
npm whoami
bun run prepublishOnly
npm publish --access publicOr one-off dry run:
bun run pack:dry-runCLI
rex --help
rex --expr "when x do y end"
rex --file input.rex
cat input.rex | rex
rex --expr "a and b" --ir
rex --expr "x = method + path x" --minify-names --dedupe-valuesRun without installing globally:
bunx @creationix/rex --help
bunx @creationix/rex --expr "when x do y end"
npx -y @creationix/rex -- --help
npx -y @creationix/rex -- --expr "when x do y end"npx works with Node.js alone (v22.18+). bunx works with Bun alone.
Programmatic API
import { compile, parseToIR, optimizeIR, encodeIR } from "@creationix/rex";
const source = "when x do y else z end";
const encoded = compile(source);
const optimized = compile(source, { optimize: true, minifyNames: true, dedupeValues: true });
const ir = parseToIR(source);
const optimizedIR = optimizeIR(ir);
const reEncoded = encodeIR(optimizedIR);