I had made preparations to modify my BF interpreter for this, but having recognised that I was going to have to make major changes to the architecture anyway, I decided to do it as a separate project. It's possible the Rust experience I've gained will make it even better than that was!
This is more for me to learn about writing a compiler than for flexing, so it's going to be titanic!
- Lexer: Source →
Token
“stream”. - Parser:
Token
stream → Abstract Syntax Tree. Makes sure brackets are balanced. - Optimisation: Consecutive operator reduction, buffered I/O. This may occur within several of the other stages.
- Code Generation: (NASM) x86 assembly, possibly ARM in the future.