One commit, because the parts below only build together. Allocator: an interval needed at the current instruction is never evicted, and the allocated-program verifier checks that every operand sits where the allocation says. AArch64 encoder: compiler_aarch64.zi encodes allocated machine IR with the shared ARM byte helpers, maps the function-address relocation, sign-extends signed 8- and 16-bit loads and rejects what it cannot encode with a named diagnostic. It has no AOT ELF writer yet. Native default with checked pointers and no fallback: on linux-x86_64, `ziran run app.zx`, `zi2zx run`, the embedding API's Auto and the Kryon players run a bundle's verified program as native code in W^X memory. Stray and freed pointers, double free, bounds and read-only stores trap. A native gap is a named preflight error, nothing falls back to the engine, and `--backend engine` picks it explicitly. zx2native uses the same preflight. Native code exchanges module state for hot reload, checks the stack, zeroes fresh locals, spends fuel at the engine's checkpoints and returns records, arrays and strings from host calls. `zi2zx --debug` source origins name lines in native traps and `zx2native --emit map`. The host value API drops its VM prefix (HostValue, HOST_*). A call with a record result loads the hidden result address into rax only after its stack arguments are stored, and an indirect target stays in r10: rax could hold a stack argument (Kryon's text-field clip guard arrived as an address) or the target (indirect calls returning records crashed). Self-hosting ports: compiler_backend_process, compiler_backend_cache, compiler_native_names and compiler_runtime_emit replace the zir_c_build, zir_c_cache and zir_c_process C, with checked bootstrap C and Makefile rules. zir_c.toolchain again reports "compiling OUT failed:" with the head of the compiler output and a truncation marker. The parallel scheduler no longer stalls on a held compiler after reaping a finished job, and poll or read errors now fail the build. A fresh BUILD_DIR (Kryon's runtime build) builds: generated files have pattern rules, objects wait for the headers they include, and engine flags are per object instead of leaking into zi2c. Legacy removals F1-F10 and N1-N4: the duplicate LirX64 encoder and its spec test, zir_c_*, zir_runtime and zir_native, nine zero-reference spec tests, vec_capacity, the zx_metadata and native_cache_names benchmarks, build-android-host.sh and two shell wrappers are deleted; zx2native is machine-only; `zi2zx` rejects `--opt` on ZX input; the bootstrap is regenerated. ASSEMBLY docs, the legacy-removal plan, the milestones and the remaining-work plan record the current position. Co-Authored-By: Claude Opus 5.5 <[email protected]>
57 lines
3.9 KiB
Ziran
57 lines
3.9 KiB
Ziran
#import "package_common"
|
|
|
|
Guide :: (arguments: []string) -> s32 {
|
|
if arguments.count != 0 { return PkgFail("usage: ziran guide") }
|
|
PkgPrint("Ziran guide (this compiler)\n\n", false)
|
|
PkgPrint("Start a project: ziran new hello, then cd hello && ziran run.\n", false)
|
|
PkgPrint(" ziran new NAME --template lib|OWNER/REPO[:TEMPLATE] picks a template;\n", false)
|
|
PkgPrint(" ziran init --template SOURCE adds one to the current project.\n", false)
|
|
PkgPrint(" In a project, ziran run|build|check|install work on its program.\n\n", false)
|
|
PkgPrint("Edit loop: format, check, run tests, then build each target you ship.\n", false)
|
|
PkgPrint(" ziran fmt src/main.zi\n", false)
|
|
PkgPrint(" ziran check --diagnostics=json --root src src/main.zi\n", false)
|
|
PkgPrint(" ziran ir --root src -o build/ir src/main.zi\n", false)
|
|
PkgPrint(" ziran build --target=c --root src -o build/out src/main.zi\n", false)
|
|
PkgPrint(" Replace c with go for the Go target.\n", false)
|
|
PkgPrint(" ziran bundle --root src --entry main:Answer -o build/app.zx src/main.zi\n", false)
|
|
PkgPrint(" ziran run build/app.zx\n", false)
|
|
PkgPrint(" ziran run --target=c scripts/task.zi -- ARGUMENTS runs a cached native script.\n", false)
|
|
PkgPrint(" --no-cache forces compilation.\n", false)
|
|
PkgPrint(" For a ziran.toml project: ziran lock, then ziran check --project --locked.\n\n", false)
|
|
PkgPrint(" ziran features --id compile.assertions --json reports tested syntax.\n\n", false)
|
|
PkgPrint(" ziran capabilities --target=go --json reports target limits.\n\n", false)
|
|
PkgPrint(" ziran api --json --root src src/main.zi lists checked public APIs.\n\n", false)
|
|
PkgPrint("Laws: custom checks one example; forall checks a finite domain.\n", false)
|
|
PkgPrint(" #law AddZero theorem x: s32 => Add(x, 0) == x;\n", false)
|
|
PkgPrint(" #proof AddZero { unfold Add; ring; }\n", false)
|
|
PkgPrint("Keep obligations in LAWS.zi and import them from PROOF.zi;\n", false)
|
|
PkgPrint(" ziran check --root src src/PROOF.zi checks the reachable certificates.\n", false)
|
|
PkgPrint("Scalar proofs support bool, fixed-width integers, enums, and pure acyclic calls.\n", false)
|
|
PkgPrint("Unknown results need an explicit waiver; invalid proofs fail checking.\n", false)
|
|
PkgPrint("See docs/LAWS.md for proof steps and evidence.\n\n", false)
|
|
PkgPrint(" ziran explain check.type explains a diagnostic code.\n", false)
|
|
PkgPrint(" ziran explain --list --json enumerates every registered code.\n\n", false)
|
|
PkgPrint("Source shape:\n", false)
|
|
PkgPrint(" #program_export\n", false)
|
|
PkgPrint(" Answer :: () -> s32 {\n", false)
|
|
PkgPrint(" value: s32 = 42\n", false)
|
|
PkgPrint(" return value\n", false)
|
|
PkgPrint(" }\n\n", false)
|
|
PkgPrint("Declarations use name: Type, inferred locals use name :", false)
|
|
PkgPrint("= expression,\n", false)
|
|
PkgPrint("and procedures use Name :: (name: Type) -> ReturnType { ... }.\n", false)
|
|
PkgPrint("Common types: bool, s8/s16/s32/s64, u8/u16/u32/u64,\n", false)
|
|
PkgPrint("float32/float64, string, [N]T arrays, []T slices, *T pointers.\n", false)
|
|
PkgPrint("Use #import \"module\" for modules; std/vec.zi supplies Vec(T).\n", false)
|
|
PkgPrint("Project dependencies are Git repositories: ziran add URL, then\n", false)
|
|
PkgPrint("#import \"NAME/Module\" (ziran pkg list shows them) and #import \"std/text\".\n\n", false)
|
|
PkgPrint("Current boundaries:\n", false)
|
|
PkgPrint(" C, Go, and portable .zx are output paths.\n", false)
|
|
PkgPrint(" Direct owned Vec locals and parameters drop at scope exit.\n", false)
|
|
PkgPrint(" Aggregates containing Vec cannot be copied, passed, or returned.\n", false)
|
|
PkgPrint(" TextView of mutable backing bytes has target-dependent aliasing.\n", false)
|
|
PkgPrint(" GPU selections report an explicit device Gap.\n\n", false)
|
|
PkgPrint("See docs/IMPLEMENTATION_STATUS.md and docs/OWNED_VALUES.md for details.\n", false)
|
|
return 0
|
|
}
|