GitBook: [docs] 53 pages modified

This commit is contained in:
boneyard93501 2021-04-13 14:40:49 +00:00 committed by gitbook-bot
parent 07020f5ef0
commit 6188fd8bce
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF

View File

@ -1,13 +1,13 @@
# AIR # AIR
The Aquamarine Intermediate Representation \(AIR\) is a low level language to program both distributed networks and the services deployed on them. The language is comprised of five instructions: The Aquamarine Intermediate Representation \(AIR\) is a low level language to program both distributed networks and the services deployed on them. The language is comprised of a small number of instructions:
* _call_: : execution * _**call**_: : execution
* _seq_ : sequential * _**seq**_ : sequential
* _par :_ parallel * _**par** :_ parallel
* _fold_ : iteration * _**fold**_ : iteration
* _xor :_ branching & error handling * _**xor** :_ branching & error handling
* _null_ : empty instruction * _**null**_ : empty instruction
which operate on _peer-id_ \(location\), _service-id_, and _service method_ over an argument list, see Figure 1. which operate on _peer-id_ \(location\), _service-id_, and _service method_ over an argument list, see Figure 1.
@ -23,33 +23,33 @@ AIR instructions are intended to launch the execution of a service method as fol
4. The arguments specified by the argument list are passed to the method 4. The arguments specified by the argument list are passed to the method
5. The result of the method returned under the name output name 5. The result of the method returned under the name output name
**Figure 2: Sequential Instruction** ![Execution](../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29.png) **Figure 2: Sequential Instruction** ![Execution](../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29%20%281%29.png)
The seq instruction takes two instructions at most as its arguments and executes them sequentially, one after the other. The _**seq**_ instruction takes two instructions at most as its arguments and executes them sequentially, one after the other.
**Figure 3: Parallel Instruction** ![Execution](../../.gitbook/assets/air_par_3.png) **Figure 3: Parallel Instruction** ![Execution](../../.gitbook/assets/air_par_3.png)
The par</i.> instruction takes two instructions at most as its arguments and particles may execute on parallel paths iff each service referenced is hosted on a different node otherwise particles execute sequentially The _**par**_ instruction takes two instructions at most as its arguments and particles may execute on parallel paths iff each service referenced is hosted on a different node otherwise particles execute sequentially
TODO: add better graphic showing the disticntion of branching vs seq. TODO: add better graphic showing the disticntion of branching vs seq.
**Figure 4: Fold Instruction** ![Execution](../../.gitbook/assets/air_fold_4%20%281%29.png) **Figure 4: Fold Instruction** ![Execution](../../.gitbook/assets/air_fold_4%20%281%29%20%281%29.png)
The fold instruction iterates over the elements of an array and workds as follows: The _**fold**_ instruction iterates over the elements of an array and workds as follows:
* fold instruction takes three arguments: an array, a variable and an instruction * _**fold**_ instruction takes three arguments: an array, a variable and an instruction
* At each iteration, the variable is assigned an element of the array and the argument-instruction is executed * At each iteration, the variable is assigned an element of the array and the argument-instruction is executed
* The argument-instruction can access the variable and uses the next statement to trigger the next iteration * The argument-instruction can access the variable and uses the next statement to trigger the next iteration
Figure 5: XOR Instruction ![Execution](../../.gitbook/assets/air_xor_5.png) Figure 5: Branching Instruction ![Execution](../../.gitbook/assets/air_xor_5.png)
This instruction is intended for organizing branches in the flow of execution as well as for handling errors: This instruction is intended for organizing branches in the flow of execution as well as for handling errors:
* The XOR instruction takes two instructions as its arguments * The _**XOR**_ instruction takes two instructions as its arguments
* The first instruction is executed and if the execution is successful, then the second instruction is ignored * The first instruction is executed and if the execution is successful, then the second instruction is ignored
* If the first instruction fails, then the second one is executed. * If the first instruction fails, then the second one is executed.
**Figure 6: Null Instruction** ![Execution](../../.gitbook/assets/air_null_6%20%281%29.png) **Figure 6: Null Instruction** ![Execution](../../.gitbook/assets/air_null_6%20%281%29.png)
This is an empty instruction: it takes no arguments and does nothing. The null instruction is useful for generating code. This is an empty instruction: it takes no arguments and does nothing. The _**null**_ instruction is useful for generating code.