cli: bootstrap verified std bytes and math with source imports
This commit is contained in:
52 files changed
+1000
-22
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# Aji standard library
|
||||
|
||||
Bootstrap implementation in ordinary safe `.aji`: `math.aji` and `bytes.aji`. They are embedded with the compiler and compiled through the normal frontend/verifier when imported. They are library modules, not standalone `main` programs.
|
||||
|
||||
```aji
|
||||
module example
|
||||
import std.bytes;
|
||||
import std.math;
|
||||
|
||||
fn main() -> u64
|
||||
effects []
|
||||
{
|
||||
var data: [u8; 4] = zero;
|
||||
std.bytes.fill(mut data, 65);
|
||||
assert(std.bytes.equal(ref data, b"AAAA"));
|
||||
return std.math.min_u64(42, 100);
|
||||
}
|
||||
```
|
||||
|
||||
Run `zig build`, then `zig-out/bin/aji run --fuel 1000000 examples/std/bytes.aji`. No grants are needed for the pure modules. `zig build conformance -- --filter source/std` exercises the library; the full suite also checks the Quick Reference example.
|
||||
|
||||
The compiler uses its embedded copy, so rebuild after editing these files. An installed compiler needs neither this checkout nor a runtime std search path. General user imports, imported types, generics and owning collections are still future work.
|
||||
|
||||
[API reference](../docs/reference/std.md) · [Specification](../docs/spec/16-standard-library.md) · [Plan](../docs/plan/standard-library.md) · [Import RFC](../docs/rfcs/0016-standard-library-bootstrap.md)
|
||||
Reference in new issue
Block a user