Merlin: A Language Server for OCaml (Experience Report)
Fr\'ed\'eric Bour, Thomas Refis, Gabriel Scherer

TL;DR
Merlin is a language server for OCaml that enhances editor support with features like autocompletion and error checking, built through incremental, error-tolerant extensions of existing OCaml tools, offering insights valuable for language tooling development.
Contribution
This paper details the design and implementation of Merlin, a novel OCaml language server that improves editor integration by extending existing tools for better incrementality and error handling.
Findings
Merlin provides real-time feedback and navigation features for OCaml editors.
Extensions to OCamllex and Menhir support incremental parsing and error recovery.
The approach can be adapted to other programming languages and tooling ecosystems.
Abstract
We report on the experience of developing Merlin, a language server for the OCaml programming language in development since 2013. Merlin is a daemon that connects to your favourite text editor and provides services that require a fine-grained understanding of the programming language syntax and static semantics: instant feedback on warnings and errors, autocompletion, `type of the code under the cursor', `go to definition', etc. Language servers need to handle incomplete and partially-incorrect programs, and try to be incremental to minimize recomputation after small editing actions. Merlin was built by carefully adapting the existing tools (the OCamllex lexer and Menhir parser generators) to better support incrementality, incompleteness and error handling. These extensions are elegant and general, as demonstrated by the interesting, unplanned uses that the OCaml community found for…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
