I would like feedback on whether a BASIC09 frontend/tool would be appropriate for LLVM, and if so, what shape the upstreaming path should take.
I have a working prototype branch here:
https://github.com/DrPitre/llvm-project/tree/basic09-compiler
Summary
The prototype adds a new LLVM tool, basic09c, under llvm/tools/basic09c.
basic09c currently implements:
- BASIC09 lexing and parsing
- AST construction and AST dumps
- initial semantic checks
- symbol handling
- LLVM IR emission for a useful subset of the language
- lit tests for lexer/parser/AST/semantic behavior
- lit tests for emitted LLVM IR
The frontend is intentionally target-independent. It emits LLVM IR and does not depend on any MC6809 backend or OS-9 support.
Motivation
BASIC09 was a structured BASIC dialect used on OS-9/6809 and OS-9/68K systems, especially the Tandy Color Computer ecosystem. It has procedures, typed variables, arrays, control flow, and a compilation model that makes it a reasonable candidate for preservation through a modern compiler infrastructure.
My goal is to preserve and compile existing BASIC09 programs by lowering them to LLVM IR. Longer term, this could allow BASIC09 programs to target multiple backends, not just historical 6809 systems.
This work started in the context of MC6809/OS-9 experimentation, but I have separated the compiler frontend from that backend-specific work. The frontend should stand on its own.