Skip to content

Latest commit

 

History

History
168 lines (111 loc) · 2.13 KB

DEVELOPMENT.md

File metadata and controls

168 lines (111 loc) · 2.13 KB

Aqua-compiler development

This document describes the setup for developing Aqua.

Quick setup

Clone the repo:

git clone [email protected]:sovereign-labs/aqua-compiler.git

Install dependencies:

cd aqua-compiler
npm install

Then run it:

npm start

Or with live reload:

npm run start:dev

Build Aqua

Build the parser:

npm run build-parse

Build TypeScript code:

npm run build 

Compile a file

aqua test.aqua

Or:

npx ts-node src/cli.ts examples/test.aqua

Executing a file

aqua exec test.aqua

Or:

npx ts-node src/cli.ts exec examples/test.aqua

Run the REPL

aqua

Or:

npx ts-node src/cli.ts

Or

npm run start:repl

Trying entering expressions at the REPL prompt:

  • txn Amount >= 1000;
  • 15 + txn Amount >= 1000;
  • txn Amount <= arg 0;
  • txn Amount + arg0 > 1000 && arg1 > 30;
  • txn Receiver == addr ABC123;
  • "a string" == txn Something;
  • return 1+2;

Visualise the AST

npm run start:ast

Run tests

npm test

Or

npm run test:watch

Build the binary executables

Make sure to have use Node.js v12.15.0 which is known to work with Nexe.

Use nvm to install and swap between different versions of Node.js:

nvm install 12.15.0
nvm use 12.15.0

!! Build the TypeScript code:

npm run build

Build for each platform:

npm run build-macos
npm run build-linux
npm run build-win

Or

npm run build-all

NOTE: Linux and MacOS builds should be built on Linux.

Deployment

The Aqua compiler is automatically deployed.

To deploy a new version simply tag the commit for the new release with the version number in the following form:

v0.0.5

Don't forget to add the v to the tag, this is how the deployment pipeline knows the tag is a version (and not some other tag).

Now push tags:

git push --tags

The updated version will deploy automatically to npm and a GitHub release will be created with executables for each platform (provided the automated tests pass).