SedaiBasic2 is a small experimental BASIC interpreter built around a pure register-based virtual machine.
The goal of the project is to explore a clean and compact VM design rather than to recreate any specific dialect of BASIC.
Current implementation details:
- FSM-based lexer with fast-path scanning;
- Packrat parser with memoization;
- Pratt parser for expressions;
- Semi-pruned SSA generator with an 11-stage optimization pipeline;
- Bytecode compiler with two additional optimization stages;
- Register-based VM with separate Int64, Float64, and String register files (256 slots, auto-expanding up to 65,535);
- Tiny BASIC subset implemented; Commodore BASIC v7 and Visual Basic 6 coverage planned.
There is also a benchmark script in the repository used mainly for validating the VM and measuring the impact of the register architecture.
The project is written entirely in Free Pascal, and feedback is welcome — especially from people interested in language design, virtual machines, parsers, and compiler pipelines.
SedaiBasic2 is a small experimental BASIC interpreter built around a pure register-based virtual machine. The goal of the project is to explore a clean and compact VM design rather than to recreate any specific dialect of BASIC.
Current implementation details: - FSM-based lexer with fast-path scanning; - Packrat parser with memoization; - Pratt parser for expressions; - Semi-pruned SSA generator with an 11-stage optimization pipeline; - Bytecode compiler with two additional optimization stages; - Register-based VM with separate Int64, Float64, and String register files (256 slots, auto-expanding up to 65,535); - Tiny BASIC subset implemented; Commodore BASIC v7 and Visual Basic 6 coverage planned.
There is also a benchmark script in the repository used mainly for validating the VM and measuring the impact of the register architecture.
The project is written entirely in Free Pascal, and feedback is welcome — especially from people interested in language design, virtual machines, parsers, and compiler pipelines.