#fluence #air #webassembly #programming-language

air-interpreter-wasm

Distribution of AIR interpreter as .wasm

487 releases (15 breaking)

new 0.16.3 Oct 20, 2021
0.15.4 Oct 5, 2021
0.11.0-new-data.14 Jul 19, 2021
0.8.0 Mar 26, 2021
0.2.1-stepper-version.0 Dec 31, 2020

#34 in WebAssembly

Download history 338/week @ 2021-07-06 230/week @ 2021-07-13 1406/week @ 2021-07-20 381/week @ 2021-07-27 1066/week @ 2021-08-03 887/week @ 2021-08-10 318/week @ 2021-08-17 612/week @ 2021-08-24 227/week @ 2021-08-31 14/week @ 2021-09-07 546/week @ 2021-09-14 810/week @ 2021-09-21 572/week @ 2021-09-28 854/week @ 2021-10-05 618/week @ 2021-10-12 637/week @ 2021-10-19

2,565 downloads per month

Apache-2.0

310KB

crates.io version npm version

Aquamarine

  • composability medium
  • allows developers to express network choreography in a script
  • moves script & data from peer to peer in a single-use logical network with checking merkle proofs and signatures.

aquamarine scheme


Fluence stack

Fluence nodes uses AIR to coordinate requests between different services run by Marine:


aquamarine scheme


Aquamarine Intermediate Representation

AIR: What is it?

  • S-expression-based low-level language
  • Controls Fluence network and its peers
  • Inspired by WAT (WebAssembly Text Format)
  • Meant to be a compile target
  • Development meant to happen in a higher-level language
  • Syntax is in flux, will change

Scripts written in AIR look like this:

fold example
  1. Gather chat members by calling chat.members
  2. Iterate through elements in members array, m = element
  3. Each m is an object, represented as array; [0] is the first field
  4. (next m) triggers next iteration

AIR: Instructions

call: execution

call structure
  • call commands the execution
  • moves execution to a peer, specified by location
  • peer is expected to have specified WASM service
  • the service must have specified function available to be called
  • argument list is given to the function
  • result of the function is saved and available under output name
  • example call could be thought of as data.result = dht.put(key, value)

seq: sequential

seq structure
  • seq takes two instructions
  • executes them sequentially

par: parallel

par structure
  • par takes two instructions
  • executes them in parallel

fold: iteration

fold structure
  • fold takes an array, a variable and an instruction
  • iterates through the array, assigning each element to the variable
  • on each iteration instruction is executed
  • instruction can read the variable
  • next triggers next iteration

xor: branching & error handling

xor structure
  • xor takes two instructions
  • iff first instruction fails, second one is executed

null

null structure
  • null takes no arguments
  • does nothing, useful for code generation

No runtime deps