Skip to content

Use it from JavaScript

The checker is the npm package cella-lang: WebAssembly built with wasm-bindgen, an ES module that runs in browsers and in Node 18 or later. The language models are the packages @cella-lang/*.

import { readFileSync } from 'node:fs';
import init, { check, init_stdlib_cached, load_module_pack } from 'cella-lang';
import { assets } from 'cella-lang/assets';
await init({ module_or_path: readFileSync(assets.wasm) });
init_stdlib_cached(readFileSync(assets.stdlib)); // load the standard library snapshot
console.log(check('def two : Nat := add 1 1\n')); // the verdict as JSON
Import What
cella-lang the checker
cella-lang/assets where the data files are: the wasm, the standard library snapshot, each module’s pack
cella-lang/host calling the exports of a Cella program compiled in library mode
cella-lang/dap a debugging session shaped like the Debug Adapter Protocol
cella-lang/corpus.json runnable examples with this build’s verdicts

The package’s README on npm describes every export, the three modes (no standard library, preloaded, explicit) and the shape of the verdict JSON.