Xbasic: 1980s era BASIC, compiler to x86-64, complete with test suite
12 days ago
- #x86-64
- #compiler
- #BASIC
- xbasic64 compiles 1980s-era BASIC dialects (Tandy Color BASIC, GW-BASIC, QuickBASIC) directly to native x86-64 executables.
- Supports classic BASIC syntax with line numbers or structured code.
- Includes numeric types (Integer, Long, Single, Double) and string handling functions (LEFT$, MID$, etc.).
- Features control flow structures like IF/THEN/ELSE, FOR/NEXT, WHILE/WEND, DO/LOOP, and SELECT CASE.
- Supports procedures (SUB and FUNCTION) with recursion and file I/O operations.
- Compiles using a three-stage pipeline: Source → Lexer → Parser → Code Generator → Assembly → Executable.
- Uses a runtime library for I/O, string operations, and math functions in x86-64 assembly.
- Key design choices include no intermediate representation (IR), System V AMD64 ABI, and GW-BASIC type semantics.
- Requires Rust toolchain, system assembler (as), and system C compiler/linker (cc) with libc.
- Compatible with macOS (x86-64, ARM64 via Rosetta) and Linux (x86-64).