3. The method of claim 1 : wherein compiling the template involves parsing the template to create a first abstract syntax tree; and wherein merging the function in the host language with the subset of code written in the host language involves parsing the subset of code written in the host language to create a second abstract syntax tree, and merging the first abstract syntax tree with the second abstract syntax tree to create a third abstract syntax tree.
1. A method for converting a template written in a templating language, the method comprising: receiving the template in the templating language at a translator; compiling the template with the translator to create a function in the host language; merging the function in the host language with a subset of code written in the host language; converting the subset of code written in the host language into a safe subset of code written in the host language, wherein the safe subset of code written in the host language adheres to a pre-determined schema and a pre-determined set of constraints; and translating the safe subset of code written in the host language to a subset of code written in a templated language, wherein the translating comprises: determining that an element within the safe subset of code written in the host language comprises a dynamic value, and wrapping the dynamic value with host language code that allows the dynamic value to be translated to the templated language upon execution of the subset of code written in the templated language.