Module @mithic/jsonr - v0.3.0

@mithic/jsonr

mithic npm docs license: MIT build


mithic JSON intermediate representation for sandboxed scripting


Install

npm install --save @mithic/jsonr

Basic Usage

To run an expression:

  1. Use a Parser (JsonAstParser) to parse JSON string into AST
  2. Use an Evaluator (currently Interpreter only) to evaluate the AST against an Env (DefaultEnv) to get a result as JS object

Simplified JavaScript

import { 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

License

This repository and the code inside it is licensed under the MIT License. Read LICENSE for more information.

Index

Classes

Interfaces

Type Aliases

Variables

Functions

Generated using TypeDoc