New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pilot-lang.js

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pilot-lang.js

An interpreter of the PILOT language implemented in JavaScript

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

PILOT-lang.js

This is a JavaScript based interpreter for the PILOT language.

After reading an entry on the blog of Eric S Raymond about a compiler he wrote for this language - called ieee-pilot - and reading about his frustation parsing the PILOT code, I decided to try to write an parser, but using a PEG generator instead. (According to his entry, he uses Bison on his compiler, and I think that back then, when he created his compiler, PEG didn't existed yet). The generator I used is peg.js.

After creating the parser, I created a (very simple) interpreter for it. This is still unfinished, but is already mostly compatible with the IEEE specification, and several of the extentions added by ESR.

Demo

Check the browser version of the interpreter.

Use

This interpreter lacks it's own input/output mechanism and instead, the function to create an instance of the interpreter requires to pass to it a function used for input (the one used for "Accept" instructions) and another one used for output (the one used for the "Type" instructions, like T, TH, Y and N)

On the demo/ directory, there is a command line version of the interpreter that uses nodejs, and the browser version used on the online demo.

The nodejs version uses readline for intput and process.stdout.write() for output.

The browser version uses a textarea with event listeners for it's input/output.

The use is something like this:

var code = 'T :Some PILOT code';

function inputFunction(cb) {
  // Somehow, get the input text.
  var txt = ....;

  // It is assumed this is async, so we must
  // call the callback with the text once is available.
  cb(txt);
}

function outputFunction(txt) {
  // Print the text somehow.
}

var pilot = require('pilot-lang.js')(inputFunction, outputFunction);

pilot.execute(code);

License

MIT

Keywords

FAQs

Package last updated on 13 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc