# Optimising an interpreter

**URL:** <https://discuss.ocaml.org/t/optimising-an-interpreter/10874>\
**Category:** Learning\
**Tags:** metaocaml, metaprogramming\
**Created:** [November 28, 2022, 8:56pm UTC](https://discuss.ocaml.org/t/optimising-an-interpreter/10874 "2022-11-28T20:56:34Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![yallop](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yallop/32/517_2.png) [@yallop](https://discuss.ocaml.org/u/yallop)\
**Post date:** [November 29, 2022, 2:43pm UTC](https://discuss.ocaml.org/t/optimising-an-interpreter/10874/6 "2022-11-29T14:43:40Z")

</div>

> [@Jon\_Harrop](#):
>
> I could use MetaOCaml and do staged metaprogramming. Should be easy and achieve a very respectable speedup but MetaOCaml is obscure so I assume dev tools would no longer work?

The tools mostly work.

For example, ocamlfind (with [this package](https://github.com/ocaml/opam-repository/blob/master/packages/base-metaocaml-ocamlfind/base-metaocaml-ocamlfind.base/opam), which is installed automatically) and dune (see, e.g., this [example](https://github.com/yallop/ocaml-reex/blob/94eea88bb06be5e295627f437d7a585bd9d9b0a6/lib/dune#L8-L13)) both support MetaOCaml.

I don’t know how well Merlin works with MetaOCaml, but it might work reasonably well if you use attributes rather than quotation syntax (i.e. `(2 + 3) [@metaocaml.bracket]` rather than `.<2 + 3>.`).

Libraries mostly work unmodified (since MetaOCaml is binary-compatible with OCaml), but a few libraries conflict with MetaOCaml’s additional syntax (e.g. by using `>.` for float comparison) and need minor modifications.

---

_[View the full topic](https://discuss.ocaml.org/t/optimising-an-interpreter/10874)._
