An implementation of a parser, evaluator, printer, and visualizer for SKI.
- TypeScript
- Deno
- Rust (compiled to WebAssembly)
- Nix (build orchestration)
This project includes VS Code workspace settings that require the following extensions:
- Deno - Official Deno extension for TypeScript support, linting, and IntelliSense
The .vscode/settings.json file configures:
- Enables the Deno extension for this workspace
- Disables the built-in TypeScript language server to avoid conflicts
- Configures Deno linting and import suggestions
- Install the Deno extension in VS Code
- Clone the repository
- Open the project in VS Code - the workspace settings will automatically apply
This project uses Nix for reproducible builds and version management. The build system orchestrates Rust → WASM → TypeScript builds with a single source of truth for versioning.
Note: The nixpkgs input tracks nixos-unstable branch, with the exact
commit pinned in flake.lock for reproducibility. To update to a newer nixpkgs
revision, run nix flake update.
Build everything:
nix build --extra-experimental-features 'nix-command flakes'Enter development shell:
nix develop --extra-experimental-features 'nix-command flakes'Run tests:
nix run .#test --extra-experimental-features 'nix-command flakes' # Deno tests
nix run .#test-rust --extra-experimental-features 'nix-command flakes' # Rust unit testsDeno commands (using Nix-provided Deno):
nix run .#fmt -- --check # Check formatting
nix run .#lint # Run linter
nix run .#publish -- --dry-run # Dry run publishUpdate version and generate Cargo.toml:
nix run .#update-version --extra-experimental-features 'nix-command flakes'
nix run .#generate-cargo --extra-experimental-features 'nix-command flakes'To avoid typing --extra-experimental-features every time, add to
~/.config/nix/nix.conf:
experimental-features = nix-command flakes
After nix build, WASM files are available at:
result/wasm/debug.wasm- Debug WASM (1.6MB)result/wasm/release.wasm- Release WASM (21KB)
To copy to source tree:
cp result/wasm/*.wasm wasm/With Deno (legacy):
# Build both debug and release versions
deno task build
# Build individual versions
deno task build:debug
deno task build:releaseNote: For Nix builds, see the Quick Start with Nix section above.
With Deno:
# Run tests only
deno task test
# Run full CI pipeline (build + test)
deno task ciNote: For Nix testing, use
nix run .#test(see Quick Start with Nix above).
JSR (using Nix-provided Deno):
nix run .#publish -- --dry-run --allow-dirtyCrates.io:
cd rust
cargo publish --dry-run --no-verifybuild- Build both debug and release WASM modules (Deno)build:debug- Build debug version only (Deno)build:release- Build release version only (Deno)test- Run the test suiteci- Run full CI pipeline (build then test)
The CLI bundle and compiled binaries load the arena evaluator from an embedded
WASM payload so they can run without filesystem or network access. After
building the Rust artifacts (e.g. via nix build or deno task build), update
the embedded module with:
deno run -A scripts/embed-wasm.tsCI runs this script automatically, but local builds should run it whenever the
WASM artifacts change to keep lib/evaluator/arenaWasm.embedded.ts in sync.
You can experiment with the library interactively using Deno's REPL:
deno repl --allow-readimport {
arenaEvaluator,
parseSKI,
prettyPrintSKIExpression,
} from "jsr:@maxdeliso/typed-ski";
const expr = parseSKI("(K S) I");
const result = arenaEvaluator.reduce(expr);
console.log(prettyPrintSKIExpression(result)); // "S"For a comprehensive library of curated examples, see the JSR module documentation.
- Combinators: A Centennial View, Stephen Wolfram
- To Mock a Mockingbird, Raymond Smullyan
- Combinatory Logic Volume I, Haskell Brooks Curry & Robert Feys
- D. A. Turner, "A new implementation technique for applicative languages," Software: Practice and Experience, vol. 9, no. 1, pp. 31-49, 1979. DOI: 10.1002/spe.4380090105
- W. Stoye, T. J. W. Clarke, and A. C. Norman, "Some practical methods for rapid combinator reduction," in Proceedings of the 1984 ACM Symposium on LISP and Functional Programming (LFP '84), ACM, New York, NY, USA, pp. 159-166, 1984. DOI: 10.1145/800055.802038
- H. G. Baker, "CONS should not CONS its arguments, or, a lazy alloc is a smart alloc," ACM SIGPLAN Notices, vol. 27, no. 3, pp. 24-34, 1992. DOI: 10.1145/130854.130858
"command not found: nix"
. /nix/store/*/etc/profile.d/nix.sh"Git tree is dirty" This is just a warning. The build will still work.
"builder failed" Check the full log:
nix-store -l /nix/store/*-typed-ski.drvGitHub Actions automatically:
- Install Nix
- Generate version files
- Build Rust → WASM
- Run tests
- Publish to JSR and crates.io