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
@@ -86,3 +86,9 @@ The groups `quick_reference`, `source_docs` and `air_docs` come from the `doc_gr
|
||||
[`quick-reference.md`](quick-reference.md) is the front door of the Source Reference Bundle (`QUICK.md`). It targets 4–6k tokens (about 4.4k with the navigation table, cl100k), covers most programs, and is kept consistent with spec 15.
|
||||
|
||||
**Its examples are checked.** Every ```aji block must be an excerpt of a program in `tests/conformance/source/quickref/`. Comments and whitespace are ignored, and `…` matches any text. Those programs are conformance tests, so each example is part of a program that verifies and runs. `zig build test` and `zig build agent-reference` fail on an example that is not. The concurrency programs (§7) are PENDING until layers 7–8 exist.
|
||||
|
||||
## Standard library bootstrap
|
||||
|
||||
`language/syntax.md` includes the built-in import rules (spec 15 §13). The on-demand `library/std.md` includes spec 16 and the signature table in `reference/std.md`. The source profile counts `library/` with `source_docs`. Pure library source is verified through the ordinary pipeline; no AIR bundle addition is needed. RFC 0016 records complexity growth and the plan tracks the next APIs.
|
||||
|
||||
RFC 0016 bootstrap measurement (cl100k): Quick Reference 5,511 → 5,777 (+4.8%); other source docs 28,470 → 30,461 (+7.0%); full source docs excluding AIR 33,981 → 36,238 (+6.6%). The on-demand library page is 1,346 tokens. The AIR bundle stays 160,797 bytes. The RFC also records o200k and Qwen2.5 counts.
|
||||
@@ -316,3 +316,26 @@ scope s { // every task spawned in s must
|
||||
| E2111 | graph content not plain data | store only integers, booleans, enums, structs/arrays of them and `iref`s in a graph |
|
||||
| T0010 | `iref` of another graph | use a handle with the graph it came from |
|
||||
| T0001–T0009 | runtime trap | see `kind` and `source_location` |
|
||||
|
||||
## 10. Standard library
|
||||
|
||||
Import a bundled module after the module header; call its functions by their full path. `std.bytes` and `std.math` are safe source, declare `effects []` and allocate no heap. No grants are needed. Read `/docs/library/std.md` for the API.
|
||||
|
||||
```aji
|
||||
module demo.standard
|
||||
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"));
|
||||
let index = std.bytes.find(ref data, 65);
|
||||
if index < data.len { assert(data[index] == 65); }
|
||||
return std.math.clamp_u64(42, 0, 100);
|
||||
}
|
||||
```
|
||||
|
||||
`find` returns the searched slice's length when absent; check before indexing. `clamp_u64` traps `T0002` for an inverted range. Missing import/module/member: `E7002`; duplicate import: `E7006`; wrong arguments: `E7005`. There are no aliases or user generics in this increment.
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
> QUICK.md
|
||||
docs/agent/quick-reference.md
|
||||
docs/agent/source-notes.md :: ## 10. Where to read more
|
||||
docs/agent/source-notes.md :: ## 11. Where to read more
|
||||
|
||||
> language/syntax.md
|
||||
docs/reference/grammar.ebnf
|
||||
@@ -19,6 +19,12 @@ docs/spec/15-source-language.md :: ## 4. Statements and control flow
|
||||
docs/spec/15-source-language.md :: ## 5. Expressions
|
||||
docs/spec/15-source-language.md :: ## 6. Fallible operations and `match`
|
||||
|
||||
docs/spec/15-source-language.md :: ## 13. Built-in standard modules
|
||||
|
||||
> library/std.md
|
||||
docs/spec/16-standard-library.md
|
||||
docs/reference/std.md
|
||||
|
||||
> language/types.md
|
||||
docs/spec/15-source-language.md :: ## 3. Types
|
||||
docs/spec/02-types-and-values.md :: ## 2. Integer semantics
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
Text that exists only for the Source Reference Bundle (`source-bundle.txt`). Non-normative: it points at the normative files and states which source layers are implemented.
|
||||
|
||||
## 10. Where to read more
|
||||
## 11. Where to read more
|
||||
|
||||
The other files in `/docs` hold the full rules. Open one only when this page is not enough.
|
||||
|
||||
| Need | Read |
|
||||
|---|---|
|
||||
| built-in `std.math`/`std.bytes`, signatures and failure contracts | `/docs/library/std.md` |
|
||||
| exact syntax, every construct, `match` and outcomes | `/docs/language/syntax.md` |
|
||||
| integer semantics, conversions, Copy/Send/Share, traps | `/docs/language/types.md` |
|
||||
| borrows, scopes, frame storage, slices, initialization | `/docs/language/ownership.md` |
|
||||
|
||||
Reference in new issue
Block a user