2021-04-14 11:42:20 +00:00
|
|
|
|
## Aqua
|
2021-02-01 13:17:46 +00:00
|
|
|
|
|
2021-04-30 08:51:55 +00:00
|
|
|
|
[![release](https://github.com/fluencelabs/aqua/actions/workflows/release.yml/badge.svg)](https://github.com/fluencelabs/aqua/actions/workflows/release.yml)
|
2021-09-10 14:36:21 +00:00
|
|
|
|
[![npm](https://img.shields.io/npm/v/@fluencelabs/aqua)](https://www.npmjs.com/package/@fluencelabs/aqua)
|
2021-04-30 08:51:55 +00:00
|
|
|
|
|
2021-04-14 11:42:20 +00:00
|
|
|
|
Aqua is a new-gen language for distributed systems.
|
2021-02-01 13:17:46 +00:00
|
|
|
|
|
2021-04-14 11:42:20 +00:00
|
|
|
|
Aqua programs are executed on many peers, sequentially
|
2021-04-13 13:02:36 +00:00
|
|
|
|
or in parallel, forming a single-use coordination network.
|
2021-03-19 09:40:27 +00:00
|
|
|
|
|
2021-04-14 11:42:20 +00:00
|
|
|
|
Aqua's runtime is heterogeneous: it includes browsers, servers, devices, all involved in solving a single task.
|
|
|
|
|
Therefore, Aqua scripts are compiled into several targets at once, with AIR and Typescript as a default.
|
2021-03-19 09:40:27 +00:00
|
|
|
|
|
2022-10-25 08:46:27 +00:00
|
|
|
|
Please refer to [Aqua Book](https://fluence.dev/docs/aqua-book/introduction) to learn more about Aqua language.
|
2021-04-16 17:15:45 +00:00
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
## Install and run
|
2021-04-16 17:15:45 +00:00
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
The easiest way to use Aqua is to download the latest build from npm: [@fluencelabs/aqua](https://www.npmjs.com/package/@fluencelabs/aqua).
|
2021-03-19 09:40:27 +00:00
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
```bash
|
|
|
|
|
npm i -g @fluencelabs/aqua
|
|
|
|
|
aqua --input src/aqua --output src/generated
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Input directory should contain files with `.aqua` scripts.
|
|
|
|
|
|
|
|
|
|
## Build from sources
|
|
|
|
|
|
|
|
|
|
If you want to build Aqua compiler from the sourcecode, you need [Scala](https://www.scala-lang.org/)'s `sbt` installed.
|
|
|
|
|
|
|
|
|
|
Aqua compiler itself can be compiled to and distributed either as JavaScript or Java file.
|
|
|
|
|
|
|
|
|
|
### Build to JS
|
|
|
|
|
|
|
|
|
|
Run `sbt cliJS/fullLinkOpt` to build JavaScript file. You can find the compiled file in: `cli/.js/target/scala-%scala-version%/cli-opt`.
|
2021-03-19 09:40:27 +00:00
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
Then run it with `node`:
|
2021-03-19 09:40:27 +00:00
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
```bash
|
2021-09-08 10:37:59 +00:00
|
|
|
|
node aqua-%version_number%.js -i path/to/input/dir -o path/to/output/dir
|
|
|
|
|
```
|
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
Javascript build is the default for Aqua.
|
|
|
|
|
|
|
|
|
|
### Build to JVM
|
|
|
|
|
|
|
|
|
|
Run `sbt cli/assembly` to build JAR file. It is located in `cli/.jvm/target/scala-%scala-version%/`
|
|
|
|
|
|
2021-09-08 10:37:59 +00:00
|
|
|
|
It requires `java` to run Aqua compiler in `.jar` file from the command line:
|
|
|
|
|
|
2021-09-10 14:36:21 +00:00
|
|
|
|
```bash
|
2021-09-08 10:37:59 +00:00
|
|
|
|
java -jar aqua-%version_number%.jar -i path/to/input/dir -o path/to/output/dir
|
2021-03-19 09:40:27 +00:00
|
|
|
|
```
|
2021-04-13 13:02:36 +00:00
|
|
|
|
|
|
|
|
|
## Repository structure
|
|
|
|
|
|
|
|
|
|
- **[types](./types)** – data types, arrows, stream types definitions and variance
|
|
|
|
|
- **[parser](./parser)** - parser, takes source text and produces a source AST
|
|
|
|
|
- **[model](./model)** - middle-end, internal representation of the code, optimizations and transfromations
|
2021-08-16 14:58:15 +00:00
|
|
|
|
- **[model/transform](./model/transform)** - optimizations and transfromations, converting model to the result, ready to be rendered
|
|
|
|
|
- **[model/test-kit](./model/test-kit)** - tests and test helpers for the model and transformations
|
2021-04-13 13:02:36 +00:00
|
|
|
|
- **[semantics](./semantics)** - rules to convert source AST into the model
|
2021-04-13 13:05:31 +00:00
|
|
|
|
- **[linker](./linker)** - checks dependencies between modules, builds and combines an abstract dependencies tree
|
2021-08-03 14:23:28 +00:00
|
|
|
|
- **[backend](./backend)** - compilation backend interface
|
|
|
|
|
- **[compiler](./compiler)** - compiler as a pure function made from _linker_, _semantics_ and _backend_
|
2021-04-13 13:02:36 +00:00
|
|
|
|
- **[backend/air](./backend/air)** – generates AIR code from the middle-end model
|
|
|
|
|
- **[backend/ts](./backend/ts)** - generates AIR code and Typescript wrappers for use with Fluence JS SDK
|
|
|
|
|
- **[cli](./cli)** - CLI interface
|
2021-09-10 14:36:21 +00:00
|
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
2022-10-25 08:46:27 +00:00
|
|
|
|
- [Aqua Book](https://fluence.dev/docs/aqua-book/introduction)
|
|
|
|
|
- [Aqua Changelog](https://fluence.dev/docs/aqua-book/changelog)
|
2021-09-10 14:36:21 +00:00
|
|
|
|
- [Fluence docs](https://fluence.dev/)
|
|
|
|
|
- [Examples & tutorials](https://github.com/fluencelabs/examples)
|
|
|
|
|
- [Aqua Playground](https://github.com/fluencelabs/aqua-playground)
|