From a21f60cd894ed11851581e793947ad82c4d611de Mon Sep 17 00:00:00 2001 From: Eremey Valetov Date: Sun, 29 Mar 2026 19:30:16 -0400 Subject: [PATCH] Release v0.16.0: AOT compiler (89%), Jupyter kernel, Hardware I/O, string GC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version 0.16.0 consolidates the major features added since v0.14.0: Ahead-of-time compiler (gwbasic-compile): - Translates .bas programs to C source → GCC → native executables - 64 of 72 test programs produce correct output (89%) - Zero compile errors — all 72 programs compile successfully - Token embedding for complex statements (PRINT USING, DEF FN, graphics, file I/O, MID$ assignment) - String comparison, division-by-zero detection, ON ERROR GOTO/RESUME - libgwrt.a runtime library from existing interpreter modules Jupyter kernel (gwbasickernel): - Persistent subprocess with sentinel protocol - Inline Sixel graphics rendering (pure-Python decoder → PNG) - INPUT statement support via Jupyter stdin protocol - Pygments GW-BASIC syntax highlighter Hardware I/O simulator (portio.c): - 8253 PIT, PPI speaker, CGA mode/color, COM1, game port - Continuous tone via PulseAudio pthread worker Interpreter improvements: - 100% token coverage (all 144 GW-BASIC tokens handled) - String space pool with compacting garbage collector - RESET, ENVIRON/ENVIRON$, ERDEV/ERDEV$, IOCTL/IOCTL$, LCOPY, DATE$/TIME$ assignment, CALL, COM --- docs/architecture.md | 4 ++-- docs/development.md | 3 ++- docs/index.md | 2 +- docs/roadmap.md | 17 ++++------------- include/gwbasic.h | 2 +- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 6edf02a..5bdde6c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -59,8 +59,8 @@ HAL writes straight to stdout. ## Source Layout ``` -src/ — core interpreter (23 files) -include/ — headers (15 files) +src/ — core interpreter + compiler (27 files) +include/ — headers (18 files) platform/ — HAL backends (1 file) gwbasickernel/ — Jupyter notebook kernel (Python, 6 files) tests/ — 72 automated test programs, 4 classic interactive programs, compat harness diff --git a/docs/development.md b/docs/development.md index 9428283..bc6b24e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -18,7 +18,8 @@ | 0.12.0 | | BSAVE/BLOAD, TUI ANSI 16-color rendering, CGA graphics framebuffer PEEK/POKE, keyboard shift flags | | 0.13.0 | | VIEW/WINDOW/PALETTE graphics, PMAP function, MBF float format for CVS/CVD/MKS$/MKD$ | | 0.14.0 | | MBF binary file compatibility (IEEE↔MBF at save/load boundary), fix binary loader null-byte truncation, fix DRAW M/S/A bugs, add TA/=var;/X substring | -| 0.15.0 | | Hardware I/O simulator, gap-fill (100% token coverage), string pool + compacting GC, Jupyter kernel, ahead-of-time compiler (Phase 1) | +| 0.15.0 | | Hardware I/O simulator, gap-fill (100% token coverage), string pool + compacting GC, Jupyter kernel (Sixel graphics, INPUT, Pygments), ahead-of-time compiler Phase 1 | +| 0.16.0 | | AOT compiler complete: 64/72 tests pass (89%), zero compile errors. Token embedding for complex statements, string comparison, division-by-zero detection, FIELD read-back, PMAP/POINT, MID$ assignment, CVI/MKI$, CLEAR resize, ENVIRON/IOCTL$ delegation | ## Tests diff --git a/docs/index.md b/docs/index.md index c3f4917..558e565 100644 --- a/docs/index.md +++ b/docs/index.md @@ -28,7 +28,7 @@ version is structured as modular C suitable for new feature development. - **Classic programs** — Hamurabi, Lunar Lander, Gunner, and Diamond from David Ahl's *BASIC Computer Games* (1978) run out of the box - **Ahead-of-time compiler** — `gwbasic-compile prog.bas -c` produces native - executables via C codegen + GCC (Phase 1: core statements + expressions) + executables via C codegen + GCC (64/72 tests pass, 89%) - **Jupyter kernel** — inline Sixel graphics, INPUT support, Pygments syntax highlighting; `pip install -e . && gwbasickernel-install --user` - **72 test programs** with golden-file regression testing and DOSBox-X diff --git a/docs/roadmap.md b/docs/roadmap.md index 4005711..e326652 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,8 +1,8 @@ # Roadmap -## The Big One (In Progress) +## Completed -### Ahead-of-Time Compiler (v0.15.0, Phase 1) +### Ahead-of-Time Compiler (v0.16.0) `gwbasic-compile` translates tokenized .bas programs to C source, then invokes GCC to produce native executables linked against `libgwrt.a`. @@ -37,17 +37,8 @@ MID$ assignment delegation, ON ERROR GOTO with setjmp/gw_run_jmp, RESUME/RESUME NEXT, ERR/ERL, file I/O delegation (OPEN/CLOSE/PRINT#/ INPUT#/WRITE#/LINE INPUT via emit_delegate_stmt), PMAP/POINT/PSET graphics, BSAVE/BLOAD/SAVE/LOAD, MKDIR/CHDIR/RMDIR/KILL file ops. -**64 produce correct output (89%).** Division-by-zero detection, -FIELD/GET variable read-back, CLS graphics flush, IOCTL$() handler. -Only 5 failures remain: 3 structural (CHAIN/COMMON/RUN "file") and -2 RNG-dependent. - -**Phase 3**: random-access files, PRINT USING, graphics, sound, event -trapping, remaining statements. - -**Phase 4**: optimizations (constant folding, integer fast paths, dead code). - -## Completed +**64 of 72 tests produce correct output (89%).** Only 5 failures remain: +3 structural (CHAIN/COMMON/RUN "file" unsupported) and 2 RNG-dependent. ### Hardware I/O Simulator (v0.15.0) diff --git a/include/gwbasic.h b/include/gwbasic.h index 5fbc149..1a408a9 100644 --- a/include/gwbasic.h +++ b/include/gwbasic.h @@ -10,7 +10,7 @@ #include "gw_math.h" #include "strings.h" -#define GW_VERSION "0.15.0" +#define GW_VERSION "0.16.0" #define GW_BANNER "GW-BASIC " GW_VERSION /* Tokenizer */