mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-28 02:33:18 +03:00
add some READMES
This commit is contained in:
parent
c1e9c72d2a
commit
a503dbb50b
@ -1 +1,30 @@
|
||||
# leo-ast-passes
|
||||
|
||||
[![Crates.io](https://img.shields.io/crates/v/leo-ast.svg?color=neon)](https://crates.io/crates/leo-ast)
|
||||
[![Authors](https://img.shields.io/badge/authors-Aleo-orange.svg)](../AUTHORS)
|
||||
[![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md)
|
||||
|
||||
## Usage
|
||||
|
||||
The code here is split into several usages. Each usage represents a different pass or modification when given an AST.
|
||||
|
||||
### Canonicalization
|
||||
|
||||
This pass of the code has a few changes it must complete:
|
||||
|
||||
- `Self` is not allowed outside a circuit.
|
||||
- `Self` in circuits must be replaced with an Identifier containing the Circuit Name.
|
||||
- Any 0 size array definitions should be rejected.
|
||||
- Multi-size array definitions should be expanded such that `[0u8; (2, 3)]` becomes `[[0u8; 3] 2]`.
|
||||
- Compound assignments become simple assignments such that `a += 2;` becomes `a = a + 2;`.
|
||||
- Missing function output types are replaced with an empty tuple.
|
||||
|
||||
### Import Resolution
|
||||
|
||||
This pass iterates through the import statements(nestedly), resloving all imports. Thus adding the improted file's AST to the main AST.
|
||||
|
||||
In addition, it also handles forcibly importing the stdlib prelude files.
|
||||
|
||||
## Structure
|
||||
|
||||
Each different type of pass is located in its own directory within the src directory.
|
||||
|
@ -1 +1,29 @@
|
||||
# leo-ast-passes
|
||||
# leo-stdlib
|
||||
|
||||
[![Crates.io](https://img.shields.io/crates/v/leo-ast.svg?color=neon)](https://crates.io/crates/leo-ast)
|
||||
[![Authors](https://img.shields.io/badge/authors-Aleo-orange.svg)](../AUTHORS)
|
||||
[![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md)
|
||||
|
||||
This directory includes the standard library for Leo.
|
||||
|
||||
## Usage
|
||||
|
||||
The src directory is the Rust code that makes the Leo folders and files statically built into the compiler. So any added Leo folders and files under the `stdlib` directory will be automatically included at compile time.
|
||||
|
||||
See the [Structure](#structure) section for more info.
|
||||
|
||||
## Structure
|
||||
|
||||
The structure for this repository is a bit special.
|
||||
|
||||
One important thing to note is the prelude directory. Any Leo files defined in this directory will have all importable objects automatically imported to every Leo program. For example, the following program is valid without any imports:
|
||||
|
||||
```typescript
|
||||
function main() {
|
||||
let s: string = "Hello, string type alias!";
|
||||
}
|
||||
```
|
||||
|
||||
The above type alias is auto imported from `stdlib/prelude/string.leo`.
|
||||
|
||||
The other directories must have explicit imports. For example, the unstable Blake2s can be imported with `import std.unstable.blake2s.Blake2s`. Which imports the `Blake2s` circuit defined in `stdlib/unstable/blake2s.leo`.
|
||||
|
Loading…
Reference in New Issue
Block a user