A lot of these problems are mitigated by just keeping it simple. You don&#x27;t, for example, need to design the templating language. Use an existing, successful language, and invert how it parses strings, and add a nicety for expressions. You can probably even reuse most of the parser, and then output code that runs by the language&#x27;s eval. This gives you all of the language&#x27;s constructs nearly for free. Python&#x2F;Ruby&#x2F;Lua&#x2F;Elixir&#x2F;Julia would be great for this. This also produces a better result: I can&#x27;t tell you how maddening it is to not have basic language constructs in, say, Django templates, because the template designer decided to write a whole second much crappier language inside the language you&#x27;re using. And this method will likely be more performant.