diff options
| author | 2026-10-14 08:45:35 +0330 | |
|---|---|---|
| committer | 2026-10-14 08:45:35 +0330 | |
| commit | d981870038c3ffa531f5c1d07e4aec855e061491 (patch) | |
| tree | 9b88cc64668a54a7b240bd180a12c5f2779bd081 /README.md | |
| parent | feat: grow memory limits, add icon/actor libraries, overhaul LSP diagnostics (diff) | |
build: generate everything into build/, keep src/ free of generated files
src/ carried 8.4 MB of build output: the genome header, the javascript vm and
its layout, and the language-server image, plus a second copy of the extension
server under editors/vscode/server/. none of it is source.
- move the genome from src/core/genome.h to build/core/genome.h and compile with
-Ibuild/core; `make all` bootstraps one when it is missing
- write genome.json, layout.ts, layout.js and lsp.json to build/js/
- compile tinyvm.ts to build/js/, typed by a tracked src/js/layout.d.ts so the
vm needs no generated file beside its source
- build the wasm server into build/editors/vscode/server/ and stage the whole
server into editors/vscode/server/ only while mkvsix.sh packages it
- redirect the test suite, image_run.js, tinyvm.sh, tinyvm.bat, test_win.ps1 and
the baremetal build at the new paths, and add make lspimage and make vsix
- stop tracking every generated file
also fix a build blocker: lookup_raw compared skind against K_VAR, which was
never declared, so `make genome` could not run at all. the guard is about
emitted program globals, which are K_GVAR and K_GARR.
tests/test.sh -q reports 159 passed and 21 failed both before and after this
change; every failure is pre-existing and comes from the checked-in genome being
stale relative to src/, plus the bootstrap above.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -6,7 +6,7 @@ this folder has the latest code. `docs/LEARN.md` is a tour of the language. `doc ## files -`src/core/core.c` is the native core. it contains the arm64 jit, the llvm backend (behind `-DZYLLVM`), the portable interpreter, the enhancement unit (recipe parser, vm-code lifter, optimizer and lowering), and the o3 region compiler. `src/runtime/rt.zc` provides i/o, native division enhancements, the heap, and the collector; `src/compiler/compiler.zc` is the compiler. both are written in zc and begin with an overview. together they make up the genome. `src/tools/zc0.c` is stage 0 of the bootstrap, a c compiler for the subset of zc used by `src/compiler/compiler.zc`. `src/tools/build.zc` has the resident compiler compile its own source into a fresh image, and `src/tools/mkgenome.c` turns that image into the generated, checked-in `src/core/genome.h`. `examples/` contains small programs (hello, factorial, echo, self-patching code, an owning list, a repl, a typed program, and an enhancement demo) and larger proofs of concept: +`src/core/core.c` is the native core. it contains the arm64 jit, the llvm backend (behind `-DZYLLVM`), the portable interpreter, the enhancement unit (recipe parser, vm-code lifter, optimizer and lowering), and the o3 region compiler. `src/runtime/rt.zc` provides i/o, native division enhancements, the heap, and the collector; `src/compiler/compiler.zc` is the compiler. both are written in zc and begin with an overview. together they make up the genome. `src/tools/zc0.c` is stage 0 of the bootstrap, a c compiler for the subset of zc used by `src/compiler/compiler.zc`. `src/tools/build.zc` has the resident compiler compile its own source into a fresh image, and `src/tools/mkgenome.c` turns that image into the generated `build/core/genome.h`. `examples/` contains small programs (hello, factorial, echo, self-patching code, an owning list, a repl, a typed program, and an enhancement demo) and larger proofs of concept: - `mandel.zc`: the mandelbrot set in 16.16 fixed point, with the fixed-point multiply wired in as a custom opcode. - `bf.zc`: a brainfuck compiler. it turns brainfuck into zc source, has the resident compiler compile it, and runs it (native code on the jit). it takes a program after a backtick, or runs hello world. @@ -37,7 +37,7 @@ make js make run PROG=examples/hello.zc ``` -`make genome` bootstraps the compiler, compares two self-compiled images, and updates `src/core/genome.h` only after they agree. rebuild the native, javascript, and web runtimes after changing the genome. `make check` runs the smaller suite while iterating. +`make genome` bootstraps the compiler, compares two self-compiled images, and updates `build/core/genome.h` only after they agree. rebuild the native, javascript, and web runtimes after changing the genome. `make check` runs the smaller suite while iterating. ### command-line help @@ -45,7 +45,7 @@ the native vm, portable vm, language server, bootstrap compiler, image converter the same early help option is available in `tinyvm.sh`, `tinyvm.bat`, `src/tools/zcc`, the public `src/tools/*.sh` build scripts, and the javascript vm and extraction utilities. `src/tools/zcc [-o OUT] [-k] FILE.zc` builds a standalone run-only binary. `src/tools/automap.sh run|small|default|lsp OUTDIR FILE...` generates a sized map and image; `src/tools/embed.sh std|icon|all [--check]` refreshes embedded modules, while its `lsp OUT` form writes source providers. `src/tools/mklsp.sh [OUTDIR]`, `src/tools/mklspwasm.sh [OUTFILE.wasm]` and `src/tools/mkvsix.sh [OUTFILE.vsix]` build the language server and extension. the javascript vm accepts an optional source file; without one it reads source from stdin. the extraction utilities take no input arguments and read the generated headers from their documented paths. `python3 tests/drivers/cli_help_test.py` checks the native, micro, LSP, bootstrap and image tools, shell scripts, and javascript utilities with open stdin and invalid memory settings, rejects unknown options, and confirms the language server source options still work. -`make js` regenerates the JavaScript bundle and needs Node.js and the TypeScript compiler (`tsc`). running the committed `src/js/tinyvm.js` directly needs Node.js only. +`make js` regenerates the JavaScript bundle into `build/js/` and needs Node.js and the TypeScript compiler (`tsc`). running the built `build/js/tinyvm.js` directly needs Node.js only. ### interactive runners @@ -125,14 +125,14 @@ build a package with `bash src/tools/mkvsix.sh`, then use "extensions: install f a complete, self-contained 64-bit TinyVM core implemented in JavaScript and TypeScript is provided in `src/js/`: -- `src/js/tinyvm.ts` and `src/js/tinyvm.js`: Implements the 64-bit word machine on `BigInt64Array` with byte addressing (`Uint8Array` / `DataView`), dual stacks, all 22 base opcodes, byte/float opcodes (612–619), system calls, and custom virtual enhancement execution (`xrun`). -- `src/js/genome.json`: the compiler genome loaded into VM memory. `node src/js/extract_genome.js` rebuilds it from `src/core/genome.h`, and `tests/test.sh` checks it is current. +- `src/js/tinyvm.ts` (compiled to `build/js/tinyvm.js`): Implements the 64-bit word machine on `BigInt64Array` with byte addressing (`Uint8Array` / `DataView`), dual stacks, all 22 base opcodes, byte/float opcodes (612–619), system calls, and custom virtual enhancement execution (`xrun`). +- `build/js/genome.json`: the compiler genome loaded into VM memory, generated. `node src/js/extract_genome.js` rebuilds it from `build/core/genome.h`, and `tests/test.sh` checks it is current. run any `.zc` program in Node.js: ```cmd -node src/js/tinyvm.js examples/hello.zc -node src/js/tinyvm.js examples/fact.zc -node src/js/tinyvm.js examples/mandel.zc +node build/js/tinyvm.js examples/hello.zc +node build/js/tinyvm.js examples/fact.zc +node build/js/tinyvm.js examples/mandel.zc # or via the Windows runner: tinyvm.bat js examples/primes.zc ``` |
