A collaborative lambda calculus editor built with MoonBit CRDT and JavaScript.
Part of the dowdiness/canopy monorepo.
- Real-time syntax highlighting for lambda calculus
- Error recovery with inline error display
- CRDT-based text editing for future collaboration
- Vite plugin for automatic MoonBit builds and HMR
- Node.js 18+ and npm
- MoonBit compiler (
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash) - The full monorepo cloned with submodules:
git clone --recursive https://github.com/dowdiness/canopy.git
cd examples/web
npm install
npm run dev
# Open http://localhost:5173The Vite plugin (vite-plugin-moonbit) automatically runs moon build --target js and watches for .mbt file changes during development.
npm run build
npm run previewnpm run build:deployThis installs the MoonBit CLI, fetches MoonBit package dependencies, then runs the Vite build. Use this as the build command on Cloudflare Pages or other CI environments that don't have moon pre-installed.
- Frontend: TypeScript + Vite
- Backend: MoonBit CRDT compiled to JavaScript via
vite-plugin-moonbit - Parser: Error-recovering lambda calculus parser
- Editor: contenteditable-based with AST-driven highlighting
The vite-plugin-moonbit.ts plugin handles the MoonBit integration:
- Builds MoonBit modules at startup (
moon build --target js) - Provides virtual modules (
@moonbit/crdt,@moonbit/graphviz) importable in TypeScript - Watches
.mbtfiles and triggers full reload on changes during development
- Open the editor in your browser
- Start typing lambda calculus expressions
- See real-time syntax highlighting and error detection
(\x. x + 1) 5
(\f. \x. f (f x)) (\y. y * 2) 3
if 1 then 2 else 3