(The question is not really specific to Rust. Asking here since a quite a few FMs here seem to be familiar with PL programming and, anyways, the tooling/platform used in this case is Rust.)
I am attempting to write a small DSL which emits (compiles to?) SQL DDL statements. I am using pest-parser to generate the parser. This parser is used to transform code in the DSL into Rust data-structures (structs). The data in these structs is then used to emit the target code using askama templates which are pre-defined.
The approach is working fine but it is getting tedious with lots of
else branching and looping as I extend the language with more capabilities.
What are ways in which I can better handle code-generation keeping maintainability and ability to extend in perspective?