mithic JSON intermediate representation for sandboxed scripting
npm install --save @mithic/jsonr
To run an expression:
Parser
(JsonAstParser
) to parse JSON string into ASTEvaluator
(currently Interpreter
only) to evaluate the AST against an Env
(DefaultEnv
) to get a result as JS objectimport { DefaultEnv, Interpreter, JsonAstParser, Stdlib } from '@mithic/jsonr';
const env = new DefaultEnv(null, Stdlib);
const parser = new JsonAstParser();
const evaluator = new Interpreter();
const ast = parser.parse('["+",3,5]');
const result = evaluator.eval(ast, env); // 8
This repository and the code inside it is licensed under the MIT License. Read LICENSE for more information.
Generated using TypeDoc