For anyone else who wasn't previously familiar with MetaOCaml, [1] provides an overview and relevant details of this implementation. E.g.:<p><i>BER MetaOCaml is a conservative extension of OCaml for ``writing programs that generate programs''. BER MetaOCaml adds to OCaml the type of code values (denoting ``program code'', or future-stage computations), and two basic constructs to build them: quoting and splicing. The generated code can be printed, stored in a file -- or compiled and linked-back to the running program, thus implementing run-time code optimization. A well-typed BER MetaOCaml program generates only well-scoped and well-typed programs: The generated code shall compile without type errors. The generated code may run in the future but it is type checked now.</i><p>The bit about generating only well-scoped, well-typed programs is pretty interesting!<p>[1] <a href="http://okmij.org/ftp/ML/MetaOCaml.html" rel="nofollow">http://okmij.org/ftp/ML/MetaOCaml.html</a>