Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
/ js2amb Public archive

Compiles JavaScript to Ambient protocol syntax

License

Notifications You must be signed in to change notification settings

aphelionz/js2amb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript to Ambients Compiler (js2amb)

Compiles JavaScript to Ambient protocol syntax

Background

Ambients is a protocol for distributed computation. It allows you to request and execute computation as easily as you can data inside OrbitDB. Think of it like AWS Lambda or Azure Cloud functions, but on a decentralized peer-to-peer network.

The protocol also includes guarantees as to the verfiability and safety of the code, all without a blockchain.

A working implementation of the Ambients protocol has two main functions:

  1. Compile source language code into "byecode" DAG, and store it in a distributed, peer-to-peer network.
  2. Retrieve the DAG from said network and safely + verfiably execute the code.

Description

This code, while it can be executed on its own, stands to support the ambc compiler by transliterating JavaScript code into Ambients syntax.

This effort is very alpha and there's a LOT of work to be done in order to be able to parse JS syntax fully. If you want to help, please seek us out on Gitter or by open an issue.

Install

First, install node.js Then:

$ git clone https://github.com/aphelionz/js2amb
$ cd js2amb
$ npm install

Usage

There is currently rudimentary CLI support via src/bin.js:

$ ./src/bin.js path/to/js/file.js # outputs Ambients ASCII

To see it in action, you can run the tests.

% make test

Contributing

Please do! If you're at all interested in this topic you should definitely seek us out on Gitter, open issues, and submit PRs.

License

MIT © 2019 Haja Networks Oy