# Using ppx for code generation

**URL:** <https://discuss.ocaml.org/t/using-ppx-for-code-generation/811>\
**Category:** Learning\
**Tags:** ppx\
**Created:** [September 5, 2017, 6:51am UTC](https://discuss.ocaml.org/t/using-ppx-for-code-generation/811 "2017-09-05T06:51:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [January 16, 2018, 10:54am UTC](https://discuss.ocaml.org/t/using-ppx-for-code-generation/811/4 "2018-01-16T10:54:15Z")

</div>

[My experience](https://github.com/Octachron/olivine) with generating OCaml bindings from the vulkan specification file is that manipulating OCaml AST with the help of `ppx_metaquot` scales better beyond a certain size. Depending on your aims, it may not be necessary to use the `ppx` API proper: the ppx API would be useful to insert generated content inside preexisting OCaml source file; but generating standalone OCaml source files can be done directly using the `compiler-libs` library and printing the generated AST with `Pprintast`.

---

_[View the full topic](https://discuss.ocaml.org/t/using-ppx-for-code-generation/811)._
