From 1c53304d03414890af0da7432d1aea87e754a14a Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Wed, 14 Oct 2026 08:29:46 +0330 Subject: 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, 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 --- Makefile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6c42e62..b0e0df1 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,8 @@ else EXE := IO := src/core/io_linux.c PORT := src/micro/port_linux.c + CFLAGS += -pthread + MICRO_THREADS := -DZY_THREADS endif BIN := bin @@ -41,7 +43,7 @@ $(BIN) $(B): $(BIN)/zc0$(EXE): src/tools/zc0.c src/core/memmap.h src/core/fops.h src/core/bops.h | $(BIN) $(CC) -O1 -w -fwrapv src/tools/zc0.c -Isrc/core -o $@ -$(BIN)/mkgenome$(EXE): src/tools/mkgenome.c | $(BIN) +$(BIN)/mkgenome$(EXE): src/tools/mkgenome.c src/core/memmap.h | $(BIN) $(CC) -O1 -w -fwrapv src/tools/mkgenome.c -Isrc/core -o $@ $(BIN)/genmap$(EXE): src/tools/genmap.c | $(BIN) $(CC) $(CFLAGS) src/tools/genmap.c -Isrc/core -o $@ @@ -51,27 +53,30 @@ $(BIN)/zy$(EXE): src/core/core.c $(IO) src/core/genome.h src/core/memmap.h src/c $(CC) $(CFLAGS) -DJTYPE=int src/core/core.c $(IO) -Isrc/core -o $@ # the portable microcore $(BIN)/zym$(EXE): src/micro/micro.c src/micro/micro_port.h $(PORT) src/core/genome.h src/core/memmap.h src/core/fops.h src/core/bops.h src/core/stack.h | $(BIN) - $(CC) $(CFLAGS) src/micro/micro.c $(PORT) -Isrc/core -Isrc/micro -o $@ + $(CC) $(CFLAGS) $(MICRO_THREADS) src/micro/micro.c $(PORT) -Isrc/core -Isrc/micro -o $@ # the language server is the compiler in check mode plus src/lsp/server.zc, on a map # sized to it lsp: $(BIN)/zclsp$(EXE) -$(BIN)/zclsp$(EXE): src/core/core.c src/core/io_linux.c src/core/fops.h src/core/bops.h src/core/stack.h src/core/memmap.h src/runtime/rt.zc src/compiler/compiler.zc src/lsp/server.zc src/tools/zc0.c src/tools/genmap.c src/tools/automap.sh src/tools/mklsp.sh | $(BIN) +$(BIN)/zclsp$(EXE): src/core/core.c src/core/io_linux.c src/core/fops.h src/core/bops.h src/core/stack.h src/core/memmap.h src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc src/lsp/server.zc src/lib/std.zc src/lib/icon.zc src/tools/embed.sh src/tools/zc0.c src/tools/genmap.c src/tools/automap.sh src/tools/mklsp.sh | $(BIN) CC="$(CC)" bash src/tools/mklsp.sh $(B)/lsp cp $(B)/lsp/zclsp$(EXE) $@ +src/compiler/compiler.zc: src/lib/std.zc src/lib/icon.zc src/tools/embed.sh + bash src/tools/embed.sh all + # bootstrap: zc0 compiles the compiler to g0, g0 compiles it to g1, g1 to g2. # g1 and g2 must be identical (the fixpoint), and g1 becomes src/core/genome.h. -genome: $(BIN)/zc0$(EXE) $(BIN)/mkgenome$(EXE) | $(B) +genome: $(BIN)/zc0$(EXE) $(BIN)/mkgenome$(EXE) src/compiler/compiler.zc | $(B) mkdir -p $(B)/s0 $(B)/s1 cp src/core/core.c $(IO) src/core/memmap.h src/core/fops.h src/core/bops.h src/core/stack.h $(B)/s0/ cp src/core/core.c $(IO) src/core/memmap.h src/core/fops.h src/core/bops.h src/core/stack.h $(B)/s1/ - cat src/runtime/rt.zc src/compiler/compiler.zc | $(BIN)/zc0$(EXE) > $(B)/s0/genome.h + cat src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc | $(BIN)/zc0$(EXE) > $(B)/s0/genome.h $(CC) $(CFLAGS) -DJTYPE=int $(B)/s0/core.c $(B)/s0/$(notdir $(IO)) -o $(B)/zy0$(EXE) - (cat src/tools/build.zc; printf '`'; cat src/runtime/rt.zc src/compiler/compiler.zc) | $(B)/zy0$(EXE) > $(B)/g1.bin + (cat src/tools/build.zc; printf '`'; cat src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc) | $(B)/zy0$(EXE) > $(B)/g1.bin $(BIN)/mkgenome$(EXE) < $(B)/g1.bin > $(B)/s1/genome.h $(CC) $(CFLAGS) -DJTYPE=int $(B)/s1/core.c $(B)/s1/$(notdir $(IO)) -o $(B)/zy1$(EXE) - (cat src/tools/build.zc; printf '`'; cat src/runtime/rt.zc src/compiler/compiler.zc) | $(B)/zy1$(EXE) > $(B)/g2.bin + (cat src/tools/build.zc; printf '`'; cat src/runtime/rt.zc src/core/core.zc src/compiler/compiler.zc) | $(B)/zy1$(EXE) > $(B)/g2.bin cmp $(B)/g1.bin $(B)/g2.bin cp $(B)/s1/genome.h src/core/genome.h @echo "fixpoint: $$(( $$(wc -c < $(B)/g1.bin) / 8 )) words, src/core/genome.h updated" @@ -96,7 +101,7 @@ run: | $(B) @test -n "$(PROG)" || { echo "make run PROG=examples/hello.zc"; exit 2; } bash src/tools/automap.sh run $(B)/run src/runtime/run.zc $(PROG) cp src/micro/micro.c src/micro/micro_port.h $(PORT) src/core/fops.h src/core/bops.h src/core/stack.h $(B)/run/ - $(CC) $(CFLAGS) $(B)/run/micro.c $(B)/run/$(notdir $(PORT)) -I$(B)/run -o $(B)/run/zymr$(EXE) + $(CC) $(CFLAGS) $(MICRO_THREADS) $(B)/run/micro.c $(B)/run/$(notdir $(PORT)) -I$(B)/run -o $(B)/run/zymr$(EXE) @echo "built $(B)/run/zymr$(EXE)" # JOBS sets how many sections run at once: make test JOBS=4 -- cgit v1.2.3