squiggle/packages/squiggle-lang/scripts/run.js
Vyacheslav Matyukhin 66d9cb0ab1
.mjs for all scripts
2022-09-18 19:18:10 +04:00

19 lines
396 B
JavaScript
Executable File

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