4 · System
Header libraries (.vth)
Name a .vth file in the header to load reusable vectfn definitions:
cmt mylib.vth
vectfn double.x
(d.x*2)
rtn d
vt.init
mylib.vth
(main)
branch
vectfn main
(r.double 21)
echo r cmt 42
main()
Rules: headers may only contain comments, header lines and vectfn blocks. Paths resolve relative to the file that names them, includes nest, and each file loads once.
Hardware stubs
Hosted vectc maps hardware primitives to safe stubs so graphics programs still run:
| Primitive | Hosted behavior |
|---|---|
vga0x320200 (and presets) | Prints an init banner; a real framebuffer backend is planned |
pout(port, val) / pin(port) | Accepted, no hardware touched |
px(color, x, y) | Reserved for the framebuffer backend |
Errors
Vect uses immediate failure: any fault (division by zero, bad index, bad handle, unknown variable or function) prints to stderr and exits non-zero. Errors inside header libraries name the file:
[Vect Runtime Error]: Division by zero at line 14
[Vect Execution Terminated]
vectc CLI
vectc program.vt cmt compile to bytecode + run on the VM
vectc --dump program.vt cmt print disassembled chunks, don't run
vectc --version cmt print version, e.g. vectc 0.2.3
Exit code 0 on success, 1 on runtime error, 2 on usage error.