Currently, the compiler generates code at the same time that it traverses the parse tree and builds the high-level IR (the entity tree). In fact, codegen is very tightly coupled with this IR.
By separating parse tree traversal and codegen, we can lay the foundation for a future optimizer in the Bash++ compiler. Code generation should be a later pass over the IR.
Even without an optimizer this makes architectural sense. The language server, for example, needs to traverse the parse tree but has no need to generate code.
Currently, the compiler generates code at the same time that it traverses the parse tree and builds the high-level IR (the entity tree). In fact, codegen is very tightly coupled with this IR.
By separating parse tree traversal and codegen, we can lay the foundation for a future optimizer in the Bash++ compiler. Code generation should be a later pass over the IR.
Even without an optimizer this makes architectural sense. The language server, for example, needs to traverse the parse tree but has no need to generate code.