-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(book): complete missing docs for the MVP (#65)
* docs(benchmarks): introduce fibonacci recursion example * docs(tutorial): overall instructions for creating zink project * docs(cli): guide for zinkc * docs(styles): current status and future plans * docs(compiler): details of the layout of calls * docs(compiler): introduce description for local variables * docs(examples): copy-paste examples lol * docs(stability): note for v0.1.0 * docs(benchmarks): add summary for the benchmark chapter * docs(contributing): introduce section contributing * docs(appendix): introduce appendix and pack READMEs * docs(README): add code snippet for fibonacci * chore(README): short guide for installation * docs(README): highlight for the example
- Loading branch information
Showing
42 changed files
with
715 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.log | ||
**/*target | ||
docs/book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,25 @@ | ||
# `zinkup` | ||
|
||
``` | ||
The zink components are gathered here, you can install all of the | ||
components directly with: | ||
|
||
```bash | ||
cargo install zinkup | ||
``` | ||
|
||
## Binary `elko` | ||
|
||
``` shell | ||
elko | ||
Zink's package manager | ||
Usage: elko [OPTIONS] <COMMAND> | ||
Commands: | ||
new Create a new zink project | ||
build Build zink project to EVM bytecode | ||
help Print this message or the help of the given subcommand(s) | ||
For installing only specified binaries: | ||
|
||
Options: | ||
-v, --verbose... Verbose mode (-v, -vv, -vvv, etc.) | ||
-h, --help Print help | ||
-V, --version Print version | ||
```bash | ||
cargo install zinkup --features elko,zinkc | ||
``` | ||
|
||
Available binaries: | ||
|
||
## Binary `zinkc` | ||
| Name | Description | | ||
| ------- | ----------------------- | | ||
| `elko` | Zink\'s package manager | | ||
| `zinkc` | The zink compiler | | ||
|
||
``` | ||
Zink Compiler | ||
Usage: zinkc [OPTIONS] <INPUT> | ||
## LICENSE | ||
|
||
Arguments: | ||
<INPUT> The path of the wasm file | ||
Options: | ||
-o, --output <OUTPUT> Write output to <filename> | ||
-v, --verbose... Verbose mode (-v, -vv, -vvv, etc.) | ||
-h, --help Print help | ||
-V, --version Print version | ||
``` | ||
GPL-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
# Summary | ||
|
||
- [Introduction](./introduction.md) | ||
- [Tutorial](./tutorial.md) | ||
- [Tutorial](./tutorial/README.md) | ||
- [Creating Zink Project](./tutorial/create-zink-project.md) | ||
- [Compiling Zink Project](./tutorial/compile-zink-project.md) | ||
- [Examples](./examples.md) | ||
- [Command Line Tool](./cli.md) | ||
- [Examples](./examples/README.md) | ||
- [AddTwo](./examples/add-two.md) | ||
- [Fibonacci](./examples/fibonacci.md) | ||
- [Command Line Tool](./cli/README.md) | ||
- [elko](./cli/elko.md) | ||
- [zinkc](./cli/zinkc.md) | ||
- [Styles](./styles/README.md) | ||
- [Compiler](./compiler/README.md) | ||
- [Arithmetic](./compiler/arithmetic.md) | ||
- [Calls](./compiler/calls.md) | ||
- [Control Flow](./compiler/control-flow.md) | ||
- [Locals](./compiler/locals.md) | ||
- [Recursion](./compiler/recursion.md) | ||
- [Stability](./stability.md) | ||
- [Stability](./stability/README.md) | ||
- [v0.1.0](./stability/v0.1.0.md) | ||
- [Security](./security.md) | ||
- [Benchmarks](./benchmarks.md) | ||
- [Contributing](./contributing.md) | ||
- [Benchmarks](./benchmarks/README.md) | ||
- [Fibonacci](./benchmarks/fibonacci.md) | ||
- [Contributing](./contributing/README.md) | ||
- [Architecture](./contributing/architecture.md) | ||
- [Building](./contributing/building.md) | ||
- [Testing](./contributing/testing.md) | ||
- [Appendix](./appendix/README.md) | ||
- [A - Operators](./appendix/operators.md) | ||
- [A - Optimizations](./appendix/optimizations.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
# Appendix | ||
|
||
The following sections contain reference material you may find useful | ||
in your Zink journey. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# A - Optimizations | ||
|
||
The optimizations of Zink projects now are mainly benifited from | ||
the optimizer of wasm -- `wasm-opt`, for the details of it please | ||
check [Binary Optimizations][binaryen-optimizations]. | ||
|
||
[binaryen-optimizations]: https://github.com/WebAssembly/binaryen#binaryen-optimizations |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Benchmarks | ||
|
||
This chapter terms to record the benchmarks of zink projects comparing | ||
with `solidity` and `vyper`. | ||
|
||
We are not going to compare with `yul` or `huff` since we are on different | ||
level, however, if zink is even faster than `yul` or `huff` in some cases, | ||
don't be suprised, we are born with high performance. | ||
|
||
- [Fibonacci](/benchmarks/fibonacci.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Fibonacci | ||
|
||
Benchmarks for fibonacci. | ||
|
||
## Recursion | ||
|
||
| fib(n) | Zink | Solidity@0.8.21 | | ||
| ------ | ---- | --------------- | | ||
| 0 | 110 | 605 | | ||
| 1 | 110 | 605 | | ||
| 2 | 262 | 3636 | | ||
| 3 | 414 | 6667 | | ||
| 4 | 718 | 12729 | | ||
| 5 | 1174 | 21822 | | ||
|
||
`zink` implementation in rust: | ||
|
||
```rust | ||
//! Zink fibonacci recursion | ||
|
||
#[no_mangle] | ||
pub extern "C" fn fib(n: usize) -> usize { | ||
if n < 2 { | ||
n | ||
} else { | ||
recursion(n - 1) + recursion(n - 2) | ||
} | ||
} | ||
``` | ||
|
||
`solidity` implementation: | ||
|
||
```sol | ||
/** | ||
* Solidity fibonacci recursion | ||
**/ | ||
function fib(uint n) public view returns (uint) { | ||
if (n <= 1) { | ||
return n; | ||
} else { | ||
return this.fib(n - 1) + this.fib(n - 2); | ||
} | ||
} | ||
``` | ||
|
||
Vyper is not included since it doesn't support cyclic function call :( |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Command Line Tool | ||
|
||
The zink toolchain are gathered in [zinkup][zinkup] | ||
|
||
You can install all of the components directly with: | ||
|
||
```bash | ||
cargo install zinkup | ||
``` | ||
|
||
For installing only specified binaries: | ||
|
||
```bash | ||
cargo install zinkup --features elko,zinkc | ||
``` | ||
|
||
Available binaries: | ||
|
||
| Name | Description | | ||
| ------- | ----------------------- | | ||
| `elko` | Zink\'s package manager | | ||
| `zinkc` | The zink compiler | | ||
|
||
[zinkup]: https://crates.io/crates/zinkup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The zink compiler | ||
|
||
## Installation | ||
|
||
``` | ||
cargo install zinkup --features zinkc | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
The Zink Compiler | ||
|
||
Usage: zinkc [OPTIONS] <INPUT> | ||
|
||
Arguments: | ||
<INPUT> The path of the wasm file | ||
|
||
Options: | ||
-o, --output <OUTPUT> Write output to <filename> | ||
-v, --verbose... Verbose mode (-v, -vv, -vvv, etc.) | ||
-h, --help Print help | ||
-V, --version Print version | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# Compiler | ||
|
||
The chapter illustrates the design of the zink compiler, so mostly, | ||
we are talking about `wat` and EVM bytecode `Mnemonic` here: | ||
|
||
- [Arithmetic](./arithmetic.md) | ||
- [Calls](./calls.md) | ||
- [Control Flow](./control-flow.md) | ||
- [Locals](./locals.md) | ||
- [Recursion](./recursion.md) |
Oops, something went wrong.