squiggle/packages/squiggle-lang/scripts/run.mjs
Vyacheslav Matyukhin a77bb36219
var name cleanups
2022-09-18 20:13:54 +04:00

19 lines
441 B
JavaScript
Executable File

#!/usr/bin/env node
import { SqProject } from "@quri/squiggle-lang";
const project = SqProject.create();
const src = process.argv[2];
if (!src) {
throw new Error("Expected src");
}
console.log(`Running ${src}`);
project.setSource("a", src);
project.run("a");
const result = project.getResult("a");
console.log(result.tag, result.value.toString());
const bindings = project.getBindings("a");
console.log(bindings.asValue().toString());