diff options
| author | 2026-10-14 08:29:46 +0330 | |
|---|---|---|
| committer | 2026-10-14 08:29:46 +0330 | |
| commit | 1c53304d03414890af0da7432d1aea87e754a14a (patch) | |
| tree | 97190d86cf548c9bc63f68c86a4d2a4f09809713 /tests/programs/packedfields.zc | |
| parent | a (diff) | |
feat: grow memory limits, add icon/actor libraries, overhaul LSP diagnostics
Compiler and VM
- make every memory map limit dynamic and adjustable at both build time and
runtime, including compiler tables, stacks, and every execution region
- reserve and grow tables, operand and return stacks, frame segments, and
image-building output without relocating live code or globals
- rename i/o and string helpers consistently (puts -> put_s, putn -> put_n,
scat -> cat_s) across compiler, runtime, examples, tests, and docs
- recast and consume values assigned to globals from inside functions
- allow fixed and const together, add typed closure returns (fn:t(...)),
multi-include syntax (include rt, run, core;), and recurse type inference
- never infer string literals as word, anywhere, as argument, variable, or
return type
- draft docs/BORROW.md: a borrow checker less intrusive than Rust's but more
intelligent
LSP and editor integration
- require explicit includes and give every toolchain area its own namespace
(rt, lsp, run, core)
- hover for built-in types, inferred types, values known at hover time, array
and pointer lifetime/size, library names in include statements, and inferred
lifetimes with explanations
- honor /* */ comments as documentation for variables and arguments, and stop
misattributing section headers or trailing comments as variable hints
- stream diagnostics and cancel stale requests on change
- jump to definition and references, including cross-file
- quick fixes with automatic library import, and namespace completion
Hints and diagnostics
- render hints as blue squigglies by default, with hints on/small/off per file
- suppress magic-number hints via a preceding /* */ comment, and say so
- warn on unused arguments; allow multiple _ discards in parameters, pattern
matching, and tagged enums, warning if a _ is actually used
- rewrite hint and comment prose in professional compiler-doc register
Libraries
- add icon.zc: run-time self-modification, find/replace syntax, type and block
edits, and step-through inspection of locals and globals
- add actor.zc: async actors with Actor<I,O>, implicit this, spawn/recv/send,
injected into the compiler machinery at include time rather than built in
Tooling and docs
- reorganize sources, tests, and designs into subdirectories
- unify windows entry points in tinyvm.bat and add a matching tinyvm.sh
- add --help across the toolchain
- polish the learning guide, stdlib docs, and design notes
Tests
- add accept, reject, and regression coverage across the compiler, LSP,
- runtime, icon, actors, threads, formatting, and the toolchain contracts,
plus fuzzers and property tests
Diffstat (limited to 'tests/programs/packedfields.zc')
| -rw-r--r-- | tests/programs/packedfields.zc | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/programs/packedfields.zc b/tests/programs/packedfields.zc index 8f6fe38..97afef0 100644 --- a/tests/programs/packedfields.zc +++ b/tests/programs/packedfields.zc @@ -1,29 +1,32 @@ +namespace; +include rt; + // struct fields of the sized types and f32 pack into shared words struct vtx { f32 x, y, z; u8 r, g, b, a; i16 id; u16 flags; int next; }; struct pair { u8 a; int b; u8 c; }; fn put_f(x) { asm { x @ #1220 } return 0; } -fn sp() { put_c(32); return 0; } +fn sp() { rt.put_c(32); return 0; } vtx gv; fn main() { vtx v; - vtx* p = new(vtx); + vtx* p = rt.new(vtx); pair q; - [3]vtx arr; - put_n(sizeof(vtx)); sp(); put_n(sizeof(pair)); sp(); + vtx[3] arr; + rt.put_n(sizeof(vtx)); sp(); rt.put_n(sizeof(pair)); sp(); v.x = 1.5; v.y = 0.1; v.z = 2; v.r = 200; v.g = 255; v.b = 300; v.a = 7; v.id = 0 - 3; v.flags = 65535; v.next = 99; - put_f(v.x + v.z); sp(); put_n(v.y == 0.1); sp(); - put_n(v.r); sp(); put_n(v.g); sp(); put_n(v.b); sp(); put_n(v.a); sp(); put_n(v.id); sp(); put_n(v.flags); sp(); put_n(v.next); sp(); + put_f(v.x + v.z); sp(); rt.put_n(v.y == 0.1); sp(); + rt.put_n(v.r); sp(); rt.put_n(v.g); sp(); rt.put_n(v.b); sp(); rt.put_n(v.a); sp(); rt.put_n(v.id); sp(); rt.put_n(v.flags); sp(); rt.put_n(v.next); sp(); v.r += 100; v.flags++; v.id--; v.g = v.g + 1; - put_n(v.r); sp(); put_n(v.flags); sp(); put_n(v.id); sp(); put_n(v.g); sp(); + rt.put_n(v.r); sp(); rt.put_n(v.flags); sp(); rt.put_n(v.id); sp(); rt.put_n(v.g); sp(); p.r = 9; p.a = 8; p.id = 1000; p.next = 5; p.x = 3.25; - put_n(p.r); put_n(p.a); sp(); put_n(p.id); sp(); put_n(p.next); sp(); put_f(p.x); sp(); - gv.b = 77; gv.flags = 5; put_n(gv.b); sp(); put_n(gv.flags); sp(); + rt.put_n(p.r); rt.put_n(p.a); sp(); rt.put_n(p.id); sp(); rt.put_n(p.next); sp(); put_f(p.x); sp(); + gv.b = 77; gv.flags = 5; rt.put_n(gv.b); sp(); rt.put_n(gv.flags); sp(); arr[1].a = 42; arr[2].r = 17; arr[1].next = 3; arr[0].id = 0 - 9; - put_n(arr[1].a); sp(); put_n(arr[2].r); sp(); put_n(arr[1].next); sp(); put_n(arr[0].id); sp(); put_n(arr[0].a); sp(); - put_n(sizeof(arr)); sp(); - q.a = 1; q.b = 123456789; q.c = 2; put_n(q.a); put_n(q.c); sp(); put_n(q.b); - put_c(10); - free(d*p); + rt.put_n(arr[1].a); sp(); rt.put_n(arr[2].r); sp(); rt.put_n(arr[1].next); sp(); rt.put_n(arr[0].id); sp(); rt.put_n(arr[0].a); sp(); + rt.put_n(sizeof(arr)); sp(); + q.a = 1; q.b = 123456789; q.c = 2; rt.put_n(q.a); rt.put_n(q.c); sp(); rt.put_n(q.b); + rt.put_c(10); + rt.free(d*p); second(); return 0; } @@ -34,9 +37,9 @@ o3 int bright(rgba* px, int n) { return s; } fn second() { - rgba* px = new(rgba, 50); + rgba* px = rt.new(rgba, 50); for (int i = 0; i < 50; i++) { px[i].r = i; px[i].g = i * 2; px[i].b = 255 - i; } - put_n(bright(px, 50)); put_c(' '); put_n(px[10].a); put_c(' '); put_n(px[49].a); put_c(10); - free(d*px); + rt.put_n(bright(px, 50)); rt.put_c(' '); rt.put_n(px[10].a); rt.put_c(' '); rt.put_n(px[49].a); rt.put_c(10); + rt.free(d*px); return 0; } |
