@greenpandastudios/aug-cli 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/assets/benchmarks/execution.svg +774 -637
- package/docs/assets/benchmarks/http.svg +278 -249
- package/docs/assets/benchmarks/improvements.svg +66 -66
- package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
- package/docs/assets/benchmarks/kernels.svg +1 -0
- package/docs/assets/benchmarks/memory.svg +153 -153
- package/docs/benchmark-results.json +227089 -90363
- package/docs/compatibility.md +6 -6
- package/docs/contributing-benchmarks.md +36 -6
- package/docs/dev-containers.md +8 -15
- package/docs/dgx-consumers.json +122 -0
- package/docs/dgx-gyms.json +784 -0
- package/docs/dgx-kernels.json +1170 -0
- package/docs/dgx-performance.json +227849 -0
- package/docs/dgx-spark.md +64 -0
- package/docs/diagnostics.md +1 -1
- package/docs/docker.md +16 -17
- package/docs/example-projects.json +32 -0
- package/docs/examples/approved-design/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/approved-design/domain/app.md +4 -4
- package/docs/examples/approved-design/main.md +2 -2
- package/docs/examples/calls-benchmark/index.md +36 -0
- package/docs/examples/calls-benchmark/main.md +78 -0
- package/docs/examples/calls-benchmark/operations.md +60 -0
- package/docs/examples/developer-workflow/calculator.md +5 -5
- package/docs/examples/developer-workflow/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/developer-workflow/logging/console.md +2 -2
- package/docs/examples/developer-workflow/logging/logger.md +2 -2
- package/docs/examples/developer-workflow/main.md +2 -2
- package/docs/examples/errors-benchmark/index.md +36 -0
- package/docs/examples/errors-benchmark/main.md +92 -0
- package/docs/examples/errors-benchmark/operations.md +65 -0
- package/docs/examples/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/generic-di/main.md +2 -2
- package/docs/examples/generic-di/types.md +3 -3
- package/docs/examples/hello/app/greeter.md +3 -3
- package/docs/examples/hello/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/hello/logging/console.md +2 -2
- package/docs/examples/hello/logging/logger.md +2 -2
- package/docs/examples/hello/main.md +2 -2
- package/docs/examples/index.md +18 -1
- package/docs/examples/interceptors/app.md +5 -5
- package/docs/examples/interceptors/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/interceptors/interceptors.md +2 -2
- package/docs/examples/interceptors/logging.md +3 -3
- package/docs/examples/interceptors/main.md +2 -2
- package/docs/examples/list-benchmark/index.md +35 -0
- package/docs/examples/list-benchmark/main.md +78 -0
- package/docs/examples/map-churn-benchmark/index.md +35 -0
- package/docs/examples/map-churn-benchmark/main.md +106 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
- package/docs/examples/native-blake3/hashing.md +93 -0
- package/docs/examples/native-blake3/index.md +38 -0
- package/docs/examples/native-blake3/main.md +73 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
- package/docs/examples/native-pytorch/index.md +38 -0
- package/docs/examples/native-pytorch/main.md +73 -0
- package/docs/examples/native-pytorch/tensors.md +123 -0
- package/docs/examples/native-sqlite/database.md +116 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
- package/docs/examples/native-sqlite/index.md +38 -0
- package/docs/examples/native-sqlite/main.md +73 -0
- package/docs/examples/native-zlib/compression.md +99 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
- package/docs/examples/native-zlib/index.md +38 -0
- package/docs/examples/native-zlib/main.md +78 -0
- package/docs/examples/new-syntax/console.md +2 -2
- package/docs/examples/new-syntax/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/new-syntax/greeter.md +3 -3
- package/docs/examples/new-syntax/logger.md +2 -2
- package/docs/examples/new-syntax/main.md +2 -2
- package/docs/examples/ownership-transfer/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/ownership-transfer/main.md +2 -2
- package/docs/examples/ownership-transfer/resource.md +2 -2
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- package/docs/examples/records-benchmark/data.md +55 -0
- package/docs/examples/records-benchmark/index.md +36 -0
- package/docs/examples/records-benchmark/main.md +85 -0
- package/docs/examples/strings-benchmark/index.md +35 -0
- package/docs/examples/strings-benchmark/main.md +76 -0
- package/docs/examples/tasks-benchmark/index.md +36 -0
- package/docs/examples/tasks-benchmark/main.md +89 -0
- package/docs/examples/tasks-benchmark/operations.md +58 -0
- package/docs/getting-started.md +3 -3
- package/docs/grammar.md +2 -2
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +1 -1
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +6 -0
- package/docs/language-constructs.md +9 -1
- package/docs/learn/index.md +1 -1
- package/docs/maintaining-docs.md +1 -1
- package/docs/native-implementation.md +276 -0
- package/docs/native-interop-llvm-plan.md +342 -0
- package/docs/native-package-examples.md +684 -0
- package/docs/native-packages.md +179 -0
- package/docs/packages.md +2 -2
- package/docs/performance.md +50 -29
- package/docs/production-readiness.md +11 -1
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/errors-benchmark.zip +0 -0
- package/docs/public/downloads/float-benchmark.zip +0 -0
- package/docs/public/downloads/generic-di.zip +0 -0
- package/docs/public/downloads/hello.zip +0 -0
- package/docs/public/downloads/interceptors.zip +0 -0
- package/docs/public/downloads/json-benchmark.zip +0 -0
- package/docs/public/downloads/list-benchmark.zip +0 -0
- package/docs/public/downloads/map-churn-benchmark.zip +0 -0
- package/docs/public/downloads/native-blake3.zip +0 -0
- package/docs/public/downloads/native-pytorch.zip +0 -0
- package/docs/public/downloads/native-sqlite.zip +0 -0
- package/docs/public/downloads/native-zlib.zip +0 -0
- package/docs/public/downloads/new-syntax.zip +0 -0
- package/docs/public/downloads/oidc-login.zip +0 -0
- package/docs/public/downloads/ownership-transfer.zip +0 -0
- package/docs/public/downloads/packages-app.zip +0 -0
- package/docs/public/downloads/packages-math.zip +0 -0
- package/docs/public/downloads/records-benchmark.zip +0 -0
- package/docs/public/downloads/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +24 -0
- package/docs/releasing.md +81 -6
- package/docs/research/libtorch-native-qualification.md +115 -0
- package/docs/research/native-interop-llvm.md +197 -0
- package/docs/research/qualification-methods.md +15 -0
- package/docs/roadmap.md +1 -0
- package/docs/safety-gyms.md +41 -0
- package/docs/tooling.md +16 -15
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +4 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/domain/app.aug.md +4 -4
- package/examples/approved-design/main.aug.md +2 -2
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug.md +5 -5
- package/examples/developer-workflow/logging/console.aug.md +2 -2
- package/examples/developer-workflow/logging/logger.aug.md +2 -2
- package/examples/developer-workflow/main.aug.md +2 -2
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug.md +2 -2
- package/examples/generic-di/types.aug.md +3 -3
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/greeter.aug.md +3 -3
- package/examples/hello/logging/console.aug.md +2 -2
- package/examples/hello/logging/logger.aug.md +2 -2
- package/examples/hello/main.aug.md +2 -2
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug.md +5 -5
- package/examples/interceptors/interceptors.aug.md +2 -2
- package/examples/interceptors/logging.aug.md +3 -3
- package/examples/interceptors/main.aug.md +2 -2
- package/examples/native-blake3/.aug-spec/manifest.json +16 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
- package/examples/native-blake3/AGENTS.md +5 -0
- package/examples/native-blake3/aug.lock.json +253 -0
- package/examples/native-blake3/hashing.aug +11 -0
- package/examples/native-blake3/hashing.aug.md +25 -0
- package/examples/native-blake3/main.aug +8 -0
- package/examples/native-blake3/main.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
- package/examples/native-pytorch/AGENTS.md +5 -0
- package/examples/native-pytorch/aug.lock.json +309 -0
- package/examples/native-pytorch/main.aug +8 -0
- package/examples/native-pytorch/main.aug.md +13 -0
- package/examples/native-pytorch/tensors.aug +23 -0
- package/examples/native-pytorch/tensors.aug.md +35 -0
- package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
- package/examples/native-sqlite/AGENTS.md +5 -0
- package/examples/native-sqlite/aug.lock.json +236 -0
- package/examples/native-sqlite/database.aug +15 -0
- package/examples/native-sqlite/database.aug.md +27 -0
- package/examples/native-sqlite/main.aug +8 -0
- package/examples/native-sqlite/main.aug.md +13 -0
- package/examples/native-zlib/.aug-spec/manifest.json +16 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
- package/examples/native-zlib/AGENTS.md +5 -0
- package/examples/native-zlib/aug.lock.json +236 -0
- package/examples/native-zlib/compression.aug +15 -0
- package/examples/native-zlib/compression.aug.md +27 -0
- package/examples/native-zlib/main.aug +10 -0
- package/examples/native-zlib/main.aug.md +13 -0
- package/examples/new-syntax/.aug-spec/manifest.json +3 -3
- package/examples/new-syntax/console.aug.md +2 -2
- package/examples/new-syntax/greeter.aug.md +3 -3
- package/examples/new-syntax/logger.aug.md +2 -2
- package/examples/new-syntax/main.aug.md +2 -2
- package/examples/oidc-login/aug.lock.json +6 -6
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug.md +2 -2
- package/examples/ownership-transfer/resource.aug.md +2 -2
- package/examples/packages/math/aug-package.json +1 -1
- package/native/compiler-packs.json +43 -0
- package/package.json +3 -2
- package/runtime/aug_http.c +48 -21
- package/runtime/aug_http_ir.c +30 -0
- package/runtime/aug_http_ir.h +18 -0
- package/runtime/aug_ir.c +209 -0
- package/runtime/aug_ir.h +89 -0
- package/runtime/aug_json.c +6 -1
- package/runtime/aug_runtime.c +82 -16
- package/runtime/aug_runtime.h +16 -2
- package/runtime/aug_tasks.c +38 -7
- package/runtime/aug_values.c +12 -6
- package/scripts/bootstrap-native.mjs +4 -1
- package/src/ast.js +1 -1
- package/src/checker.js +110 -28
- package/src/cli.js +92 -14
- package/src/codegen.js +31 -6
- package/src/compiler-packs.js +66 -0
- package/src/config.js +2 -2
- package/src/editor.js +15 -6
- package/src/formatter.js +4 -2
- package/src/git-http.js +137 -0
- package/src/git-packages.js +9 -1
- package/src/help.js +10 -2
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- package/src/llvm-debug.js +101 -0
- package/src/llvm-native.js +152 -0
- package/src/llvm-platform.js +20 -0
- package/src/llvm.js +781 -0
- package/src/native-artifacts.js +207 -0
- package/src/native-bindings.js +189 -0
- package/src/native-contracts.js +295 -0
- package/src/native-declarations.js +68 -0
- package/src/native-facts.js +63 -0
- package/src/package-locking.js +43 -0
- package/src/package-manager.js +23 -8
- package/src/parser.js +20 -2
- package/src/project.js +2 -2
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +8 -3
- package/src/snippets.js +1 -0
- package/src/spec.js +49 -8
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · List traversal benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/list/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[List traversal benchmark](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
::::: example-compare
|
|
23
|
+
|
|
24
|
+
:::: example-code
|
|
25
|
+
|
|
26
|
+
## Code {#code}
|
|
27
|
+
|
|
28
|
+
::: code-group
|
|
29
|
+
|
|
30
|
+
```aug [Indentation]
|
|
31
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
32
|
+
int iterations = 100000
|
|
33
|
+
own List<int> values = []
|
|
34
|
+
int index = 0
|
|
35
|
+
while index < iterations:
|
|
36
|
+
values.append(value=index * 3)
|
|
37
|
+
index = index + 1
|
|
38
|
+
int checksum = 0
|
|
39
|
+
for value in values:
|
|
40
|
+
checksum = checksum + value
|
|
41
|
+
print(value=checksum)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```aug [Braces]
|
|
45
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
46
|
+
int iterations = 100000
|
|
47
|
+
own List<int> values = []
|
|
48
|
+
int index = 0
|
|
49
|
+
while index < iterations {
|
|
50
|
+
values.append(value=index * 3)
|
|
51
|
+
index = index + 1
|
|
52
|
+
}
|
|
53
|
+
int checksum = 0
|
|
54
|
+
for value in values {
|
|
55
|
+
checksum = checksum + value
|
|
56
|
+
}
|
|
57
|
+
print(value=checksum)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
:::
|
|
61
|
+
|
|
62
|
+
::::
|
|
63
|
+
|
|
64
|
+
:::: example-spec
|
|
65
|
+
|
|
66
|
+
## Compiled specification {#specification}
|
|
67
|
+
|
|
68
|
+
### Startup
|
|
69
|
+
|
|
70
|
+
It sets `iterations` to `100000`. It sets `values` of type `List<int>` to a list with no items. `values` of type `List<int>` owns this value. It sets `index` to `0`.
|
|
71
|
+
|
|
72
|
+
While `index` is less than `iterations`, it appends `index` times `3` to `values`; then it increases `index` by `1`. After the loop, it sets `checksum` to `0`. For each `value` in a snapshot of `values`, it increases `checksum` by `value`. After the loop, it prints `checksum`.
|
|
73
|
+
|
|
74
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
75
|
+
|
|
76
|
+
::::
|
|
77
|
+
|
|
78
|
+
:::::
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Map deletion benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/map-churn"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Map deletion benchmark
|
|
12
|
+
|
|
13
|
+
Delete, replace and reinsert entries, then check values and insertion order.
|
|
14
|
+
|
|
15
|
+
Open a file to read its source beside the explanation produced by `aug spec`. **Indentation** and **Braces** display the same checked program; your choice carries across file pages.
|
|
16
|
+
|
|
17
|
+
## Project files
|
|
18
|
+
|
|
19
|
+
- [`main.aug`](main.md)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Try this project
|
|
23
|
+
|
|
24
|
+
[Download this project](/downloads/map-churn-benchmark.zip), then extract the archive in an empty working folder. It contains the checked source, configuration, and generated specs. [Install August](../../getting-started.md) once, then run these commands. Native libraries are prepared automatically when needed:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cd map-churn-benchmark
|
|
28
|
+
aug check .
|
|
29
|
+
aug spec .
|
|
30
|
+
aug run .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
See [the performance page](../../performance.md) for measurements, input sizes, and reproduction steps.
|
|
34
|
+
|
|
35
|
+
[Browse all examples](../index.md)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · Map deletion benchmark"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "benchmarks/map-churn/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[Map deletion benchmark](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
::::: example-compare
|
|
23
|
+
|
|
24
|
+
:::: example-code
|
|
25
|
+
|
|
26
|
+
## Code {#code}
|
|
27
|
+
|
|
28
|
+
::: code-group
|
|
29
|
+
|
|
30
|
+
```aug [Indentation]
|
|
31
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
32
|
+
int iterations = 4000
|
|
33
|
+
own Map<int,int> entries = {}
|
|
34
|
+
int index = 0
|
|
35
|
+
while index < iterations:
|
|
36
|
+
entries.set(key=index, value=index * 3)
|
|
37
|
+
index = index + 1
|
|
38
|
+
index = 0
|
|
39
|
+
while index < iterations:
|
|
40
|
+
entries.take(key=index)
|
|
41
|
+
index = index + 2
|
|
42
|
+
index = 0
|
|
43
|
+
while index < iterations:
|
|
44
|
+
entries.set(key=index, value=index * 7)
|
|
45
|
+
index = index + 1
|
|
46
|
+
int checksum = 0
|
|
47
|
+
int position = 1
|
|
48
|
+
for (key, value) in entries:
|
|
49
|
+
checksum = checksum + key * position + value
|
|
50
|
+
position = position + 1
|
|
51
|
+
print(value=checksum)
|
|
52
|
+
print(value=entries.length())
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```aug [Braces]
|
|
56
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
57
|
+
int iterations = 4000
|
|
58
|
+
own Map<int,int> entries = {}
|
|
59
|
+
int index = 0
|
|
60
|
+
while index < iterations {
|
|
61
|
+
entries.set(key=index, value=index * 3)
|
|
62
|
+
index = index + 1
|
|
63
|
+
}
|
|
64
|
+
index = 0
|
|
65
|
+
while index < iterations {
|
|
66
|
+
entries.take(key=index)
|
|
67
|
+
index = index + 2
|
|
68
|
+
}
|
|
69
|
+
index = 0
|
|
70
|
+
while index < iterations {
|
|
71
|
+
entries.set(key=index, value=index * 7)
|
|
72
|
+
index = index + 1
|
|
73
|
+
}
|
|
74
|
+
int checksum = 0
|
|
75
|
+
int position = 1
|
|
76
|
+
for (key, value) in entries {
|
|
77
|
+
checksum = checksum + key * position + value
|
|
78
|
+
position = position + 1
|
|
79
|
+
}
|
|
80
|
+
print(value=checksum)
|
|
81
|
+
print(value=entries.length())
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
:::
|
|
85
|
+
|
|
86
|
+
::::
|
|
87
|
+
|
|
88
|
+
:::: example-spec
|
|
89
|
+
|
|
90
|
+
## Compiled specification {#specification}
|
|
91
|
+
|
|
92
|
+
### Startup
|
|
93
|
+
|
|
94
|
+
It sets `iterations` to `4000`. It sets `entries` of type `Map<int,int>` to a context-typed empty collection with no items. `entries` of type `Map<int,int>` owns this value. It sets `index` to `0`.
|
|
95
|
+
|
|
96
|
+
While `index` is less than `iterations`, it stores `index` times `3` in `entries` under `index`; then it increases `index` by `1`. After the loop, it sets `index` to `0`. While `index` is less than `iterations`, it removes the key `index` from `entries`; then it increases `index` by `2`. After the loop, it sets `index` to `0`.
|
|
97
|
+
|
|
98
|
+
While `index` is less than `iterations`, it stores `index` times `7` in `entries` under `index`; then it increases `index` by `1`. After the loop, it sets `checksum` to `0`. It sets `position` to `1`. For each `key` and `value` in a snapshot of `entries`, it sets `checksum` to (`checksum` plus (`key` times `position`)) plus `value`; then it increases `position` by `1`.
|
|
99
|
+
|
|
100
|
+
After the loop, it prints `checksum`. It prints the number of elements in `entries`.
|
|
101
|
+
|
|
102
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
103
|
+
|
|
104
|
+
::::
|
|
105
|
+
|
|
106
|
+
:::::
|
package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-blake3/0.1.3/api.aug · Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-blake3/0.1.3/api.aug`
|
|
14
|
+
|
|
15
|
+
[Hashing with Rust BLAKE3](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
import HashError from contracts
|
|
30
|
+
extern C _hash(Bytes input) returns string unless HashError
|
|
31
|
+
/** Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. */
|
|
32
|
+
hash(Bytes input) returns string:
|
|
33
|
+
unsafe:
|
|
34
|
+
return _hash(input)
|
|
35
|
+
test hash:
|
|
36
|
+
when "vectors":
|
|
37
|
+
it "hashes_abc":
|
|
38
|
+
Bytes input = "abc".bytes()
|
|
39
|
+
assert(
|
|
40
|
+
hash(input) == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```aug [Braces]
|
|
45
|
+
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
46
|
+
import HashError from contracts
|
|
47
|
+
extern C _hash(Bytes input) returns string unless HashError
|
|
48
|
+
/** Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. */
|
|
49
|
+
hash(Bytes input) returns string {
|
|
50
|
+
unsafe {
|
|
51
|
+
return _hash(input)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
test hash {
|
|
55
|
+
when "vectors" {
|
|
56
|
+
it "hashes_abc" {
|
|
57
|
+
Bytes input = "abc".bytes()
|
|
58
|
+
assert(
|
|
59
|
+
hash(input) == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
:::
|
|
67
|
+
|
|
68
|
+
::::
|
|
69
|
+
|
|
70
|
+
:::: example-spec
|
|
71
|
+
|
|
72
|
+
## Compiled specification {#specification}
|
|
73
|
+
|
|
74
|
+
### `hash` · [source](api.md#code) {#symbol-hash}
|
|
75
|
+
|
|
76
|
+
Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. It takes `input` as `Bytes`. Failures can raise [`HashError`](contracts.md#symbol-HashError).
|
|
77
|
+
|
|
78
|
+
Within an unsafe block, it returns [`_hash`](api.md#symbol-_hash) with `input`. Native operations must satisfy their declared C contracts.
|
|
79
|
+
|
|
80
|
+
### `_hash` · [source](api.md#code) {#symbol-_hash}
|
|
81
|
+
|
|
82
|
+
It is private to its defining scope. It takes `input` as `Bytes`. It returns `string`. Failures can raise [`HashError`](contracts.md#symbol-HashError).
|
|
83
|
+
|
|
84
|
+
Native implementation: `@greenpandastudios/aug-blake3@0.1.3`, `1.8.7`. Supported targets: linux arm64 glibc 2.36+, linux x64 glibc 2.36+, macos arm64 14.0+. Binding contract: [`native.abi.json`](native.abi-json.md) (SHA-256 `3bf8dea97cde70a03021bf77ea08314d6d37fe7b4935ff16030b2ab929c21279`). It calls `aug_blake3_hash_v1` through the C ABI on the caller thread; a blocking native call blocks that thread. August copies the returned buffer, then calls `aug_blake3_text_release_v1` to release it. The compiler checks the provider, descriptor digest, signature and ownership at August call sites. The native author promises not to retain inputs, enter August from foreign threads, or unwind across the C boundary; internal native workers may run. The compiler does not prove those promises.
|
|
85
|
+
|
|
86
|
+
### `test hash` · [source](api.md#code) {#symbol-test-20-hash}
|
|
87
|
+
|
|
88
|
+
Tests [`hash`](api.md#symbol-hash). Each case gets fresh setup and dependencies.
|
|
89
|
+
|
|
90
|
+
#### `vectors`
|
|
91
|
+
|
|
92
|
+
##### `hashes_abc` · [source](api.md#code)
|
|
93
|
+
|
|
94
|
+
It sets `input` of type `Bytes` to `bytes` on `"abc"`. The test requires [`hash`](api.md#symbol-hash) with `input` equals `"6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"`.
|
|
95
|
+
|
|
96
|
+
### Dependencies
|
|
97
|
+
|
|
98
|
+
It uses [`HashError`](contracts.md#symbol-HashError) from `contracts`.
|
|
99
|
+
|
|
100
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
101
|
+
|
|
102
|
+
::::
|
|
103
|
+
|
|
104
|
+
:::::
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug · Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
pageClass: aug-example-page
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# `packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug`
|
|
14
|
+
|
|
15
|
+
[Hashing with Rust BLAKE3](../../../../../index.md) · Dependency source and specification
|
|
16
|
+
|
|
17
|
+
This is the exact dependency version used by this example.
|
|
18
|
+
|
|
19
|
+
::::: example-compare
|
|
20
|
+
|
|
21
|
+
:::: example-code
|
|
22
|
+
|
|
23
|
+
## Code {#code}
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```aug [Indentation]
|
|
28
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
29
|
+
HashError(int code, string message) implements Error:
|
|
30
|
+
pass
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```aug [Braces]
|
|
34
|
+
// aug-spec: "contracts.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
35
|
+
HashError(int code, string message) implements Error {
|
|
36
|
+
pass
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
::::
|
|
43
|
+
|
|
44
|
+
:::: example-spec
|
|
45
|
+
|
|
46
|
+
## Compiled specification {#specification}
|
|
47
|
+
|
|
48
|
+
### `HashError` · class · [source](contracts.md#code) {#symbol-HashError}
|
|
49
|
+
|
|
50
|
+
It implements `Error`. It takes `code` as an integer, kept read-only and `message` as a string, kept read-only.
|
|
51
|
+
|
|
52
|
+
::::
|
|
53
|
+
|
|
54
|
+
:::::
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Native binding contract · Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
search: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Native binding contract
|
|
13
|
+
|
|
14
|
+
[Hashing with Rust BLAKE3](../../../../../index.md)
|
|
15
|
+
|
|
16
|
+
This is the exact descriptor checked for this dependency. It records native symbols, ownership, errors, and ABI boundaries. The compiler checks August declarations against it; foreign implementations remain the native author’s responsibility.
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"format": 1,
|
|
21
|
+
"profile": "aug-native-abi-1",
|
|
22
|
+
"resources": [],
|
|
23
|
+
"functions": [
|
|
24
|
+
{
|
|
25
|
+
"module": "api",
|
|
26
|
+
"name": "_hash",
|
|
27
|
+
"symbol": "aug_blake3_hash_v1",
|
|
28
|
+
"params": [
|
|
29
|
+
{
|
|
30
|
+
"name": "input",
|
|
31
|
+
"kind": "bytes"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"result": {
|
|
35
|
+
"kind": "utf8",
|
|
36
|
+
"release": "aug_blake3_text_release_v1"
|
|
37
|
+
},
|
|
38
|
+
"error": "contracts.HashError",
|
|
39
|
+
"callingConvention": "C",
|
|
40
|
+
"status": "i32",
|
|
41
|
+
"uses": [],
|
|
42
|
+
"changes": [],
|
|
43
|
+
"thread": "caller",
|
|
44
|
+
"retainsInputs": false
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "hashing.aug · Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3/hashing.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `hashing.aug`
|
|
13
|
+
|
|
14
|
+
[Hashing with Rust BLAKE3](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`hashing.aug`](hashing.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "hashing.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
import HashError and hash from "https://github.com/GreenPandaStudios/aug-blake3#v0.1.3"
|
|
34
|
+
/** Hash UTF-8 text with the real Rust BLAKE3 implementation. */
|
|
35
|
+
hashText(string value) returns string unless HashError:
|
|
36
|
+
return hash(input=value.bytes())
|
|
37
|
+
test hashText:
|
|
38
|
+
when "vectors":
|
|
39
|
+
it "matches_the_published_abc_vector":
|
|
40
|
+
assert(
|
|
41
|
+
hashText(value="abc") == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```aug [Braces]
|
|
46
|
+
// aug-spec: "hashing.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
47
|
+
import HashError and hash from "https://github.com/GreenPandaStudios/aug-blake3#v0.1.3"
|
|
48
|
+
/** Hash UTF-8 text with the real Rust BLAKE3 implementation. */
|
|
49
|
+
hashText(string value) returns string unless HashError {
|
|
50
|
+
return hash(input=value.bytes())
|
|
51
|
+
}
|
|
52
|
+
test hashText {
|
|
53
|
+
when "vectors" {
|
|
54
|
+
it "matches_the_published_abc_vector" {
|
|
55
|
+
assert(
|
|
56
|
+
hashText(value="abc") == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
::::
|
|
66
|
+
|
|
67
|
+
:::: example-spec
|
|
68
|
+
|
|
69
|
+
## Compiled specification {#specification}
|
|
70
|
+
|
|
71
|
+
### `hashText` · [source](hashing.md#code) {#symbol-hashText}
|
|
72
|
+
|
|
73
|
+
Hash UTF-8 text with the real Rust BLAKE3 implementation. It takes `value` as a string. Failures can raise [`HashError`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/contracts.md#symbol-HashError). It returns [`hash`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/api.md#symbol-hash) with `input` from the UTF-8 bytes of `value`.
|
|
74
|
+
|
|
75
|
+
### `test hashText` · [source](hashing.md#code) {#symbol-test-20-hashText}
|
|
76
|
+
|
|
77
|
+
Tests [`hashText`](hashing.md#symbol-hashText). Each case gets fresh setup and dependencies.
|
|
78
|
+
|
|
79
|
+
#### `vectors`
|
|
80
|
+
|
|
81
|
+
##### `matches_the_published_abc_vector` · [source](hashing.md#code)
|
|
82
|
+
|
|
83
|
+
The test requires [`hashText`](hashing.md#symbol-hashText) with `value` `"abc"` equals `"6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"`.
|
|
84
|
+
|
|
85
|
+
### Dependencies
|
|
86
|
+
|
|
87
|
+
It uses [`hash`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/api.md#symbol-hash) and [`HashError`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/contracts.md#symbol-HashError) from `https://github.com/GreenPandaStudios/aug-blake3#v0.1.3`.
|
|
88
|
+
|
|
89
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
90
|
+
|
|
91
|
+
::::
|
|
92
|
+
|
|
93
|
+
:::::
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Hashing with Rust BLAKE3
|
|
12
|
+
|
|
13
|
+
Import a Rust implementation through an ordinary August package and verify a published BLAKE3 hash vector.
|
|
14
|
+
|
|
15
|
+
Open a file to read its source beside the explanation produced by `aug spec`. **Indentation** and **Braces** display the same checked program; your choice carries across file pages.
|
|
16
|
+
|
|
17
|
+
This project requires the August `0.21.0` LLVM preview on macOS 14+ with Apple Silicon, or Debian/Ubuntu GNU/Linux x64 or ARM64 with glibc 2.36+. The library archives are public; the matching compiler release is still being qualified.
|
|
18
|
+
|
|
19
|
+
## Project files
|
|
20
|
+
|
|
21
|
+
- [`main.aug`](main.md)
|
|
22
|
+
- [`hashing.aug`](hashing.md)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Try this project
|
|
26
|
+
|
|
27
|
+
[Download this project](/downloads/native-blake3.zip), then extract the archive in an empty working folder. It contains the checked source, configuration, and generated specs. [Install August](../../getting-started.md) once, then run these commands. Native libraries are prepared automatically when needed:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
cd native-blake3
|
|
31
|
+
aug install .
|
|
32
|
+
aug check .
|
|
33
|
+
aug spec .
|
|
34
|
+
aug test .
|
|
35
|
+
aug run .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[Browse all examples](../index.md)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "main.aug · Hashing with Rust BLAKE3"
|
|
3
|
+
generated: true
|
|
4
|
+
source: "examples/native-blake3/main.aug"
|
|
5
|
+
editLink: false
|
|
6
|
+
prev: false
|
|
7
|
+
next: false
|
|
8
|
+
outline: [2, 3]
|
|
9
|
+
pageClass: aug-example-page
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# `main.aug`
|
|
13
|
+
|
|
14
|
+
[Hashing with Rust BLAKE3](index.md) · Source and specification
|
|
15
|
+
|
|
16
|
+
::: details Files in this project
|
|
17
|
+
|
|
18
|
+
- [`main.aug`](main.md)
|
|
19
|
+
- [`hashing.aug`](hashing.md)
|
|
20
|
+
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
::::: example-compare
|
|
24
|
+
|
|
25
|
+
:::: example-code
|
|
26
|
+
|
|
27
|
+
## Code {#code}
|
|
28
|
+
|
|
29
|
+
::: code-group
|
|
30
|
+
|
|
31
|
+
```aug [Indentation]
|
|
32
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
33
|
+
import hashText from hashing
|
|
34
|
+
import HashError from "https://github.com/GreenPandaStudios/aug-blake3#v0.1.3"
|
|
35
|
+
try:
|
|
36
|
+
print(value=hashText(value="abc"))
|
|
37
|
+
catch HashError error:
|
|
38
|
+
print(value=error.message)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```aug [Braces]
|
|
42
|
+
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
|
|
43
|
+
import hashText from hashing
|
|
44
|
+
import HashError from "https://github.com/GreenPandaStudios/aug-blake3#v0.1.3"
|
|
45
|
+
try {
|
|
46
|
+
print(value=hashText(value="abc"))
|
|
47
|
+
}
|
|
48
|
+
catch HashError error {
|
|
49
|
+
print(value=error.message)
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
::::
|
|
56
|
+
|
|
57
|
+
:::: example-spec
|
|
58
|
+
|
|
59
|
+
## Compiled specification {#specification}
|
|
60
|
+
|
|
61
|
+
### Startup
|
|
62
|
+
|
|
63
|
+
It prints [`hashText`](hashing.md#symbol-hashText) with `value` `"abc"`. If this work raises [`HashError`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/contracts.md#symbol-HashError) as `error`, it prints `error.message`.
|
|
64
|
+
|
|
65
|
+
### Dependencies
|
|
66
|
+
|
|
67
|
+
It uses [`HashError`](dependencies/packages/%40greenpandastudios/aug-blake3/0.1.3/contracts.md#symbol-HashError) (`message`) from `https://github.com/GreenPandaStudios/aug-blake3#v0.1.3`. It uses [`hashText`](hashing.md#symbol-hashText) from `hashing`.
|
|
68
|
+
|
|
69
|
+
Built-in operations follow the [language reference](https://greenpandastudios.github.io/augscript/language-constructs).
|
|
70
|
+
|
|
71
|
+
::::
|
|
72
|
+
|
|
73
|
+
:::::
|