robomind-interpreter

1.1.0 • Public • Published

robomind-interpreter

Build Status Dependency Status devDependency Status

Interpretes an AST as generated by robomind-parser. robomind-interpreter was written for use by SkidBot.

API

var Interpreter = require('robomind-interpreter');

  • var interpreter = new Interpreter(stdlib) stdlib is an object containing implementations for RoboMind functions. They should accept the same arguments as their RoboMind equivalents, and return a Promise that either resolves to 0, or another integer that makes sense, or rejects with an error which stops the whole interpreting process and passes it to the user.

  • interpreter.run(ast) Interpretes the code specified with ast, using the standard library supplied in the constructor. Returns a promise.

  • interpreter.on('position', callback) callback is called whenever a function is executed, with the as argument some information on the function call: {line: 1, column: 1} for example.

Contributing

Relevant commands are:

  • npm install
  • npm test

TODOS

  • A real test suite (not just running it a bit against SkidBot.)
  • Figure out scoping rules properly (and add tests for them.)

/robomind-interpreter/

    Package Sidebar

    Install

    npm i robomind-interpreter

    Weekly Downloads

    13

    Version

    1.1.0

    License

    ISC

    Last publish

    Collaborators

    • commandoline