Any tutorial on designing edsl in ocaml?

After giving up on my idea of transpiling ocaml to lua, I thought that a nice edsl that generates code ay be good enough. However,I don’t have any experience on the topic,and the few already existing edsl are too complex to learn from, so, do anyone know any good tutorial about designing good edsl?

The Domain-specific languages (DSLs) embedded in OCaml page was a great resource for me. I used that to help craft the dkml-dune-dsl Dune eDSL.

I believe the author is Professor Oleg Kiselyov.

4 Likes

Thanks. I readied that already, and it is a good resource. I will probably need to read it a couple of times, because the first part was easy to grasp, but as soon as I reached the optimization framework I started to feel confused.
Also, there is a huge gap between the tinny, tinny language they propose and a real world project, and I was hoping for something in between.
That said, that is probably the only good resource that I found, and I am the kind of person that understands a concept better by reading different explanations on the same subject.
I was not aware of your DSL tough, so I will also take a look at it.

Search for tagless-final?

I had this post here about embedding Forth in OCaml: Can I write a ppx to replace `1` with `(add_to_stack 1)`?

Martin Fowler also wrote a book on it, but it’s from the OOP perspective: Domain Specific Languages

That is exactly the objective. Thanks for sharing your project,I’ll take a look