New tool gwbasic-compile translates tokenized .bas programs to C source, which gcc compiles into native executables linked against libgwrt.a (the interpreter's runtime modules minus the execution loop). Pipeline: .bas → gw_crunch() → analysis pass (line table, variable census, GOTO targets, DATA collection) → C codegen → gcc → native executable. Phase 1 supports: PRINT, LET, IF/THEN/ELSE, GOTO, GOSUB/RETURN, FOR/NEXT, END/STOP/SYSTEM, REM, DATA/READ/RESTORE, CLS, arithmetic/relational/logical operators, core math functions (SIN, COS, SQR, ABS, etc.), string functions (LEFT$, RIGHT$, MID$, CHR$, ASC, VAL, STR$, LEN, etc.), string concatenation. All control flow uses goto/labels (no C for/while) so GOTO into loops works. GOSUB uses a return-label stack with switch dispatch.
182 B
182 B