#ocamllex
sedlex is 1000x better than ocamllex tbh (it's also so much simpler since it's just a library with a ppx rather than the reified abstraction leak that is ocamllex)
December 5, 2024 at 5:53 PM
So, who else is doing #AdventOfCode in #OCaml this year?

My solutions, using ocamllex as usual, will be posted there:
2025 · main · Pablo Rauzy / Advent of Code · GitLab
code.up8.edu
code.up8.edu
December 1, 2025 at 1:26 PM
My exhaustiveness check for ocamllex was merged today and will be part of OCaml 5.6 🎉
About 50% of all mll files out there are affected and raise the exception 'Failure: empty token' on some input. An example of such input is now provided at compile time. github.com/ocaml/ocaml/... #ocaml
February 22, 2026 at 11:30 PM
Finished writing parser for my config language. Yes, it's that simple!

The lexer, on the other hand 😅

Still, I'm enjoying menhir and ocamllex so far, even tho the learning curve is kinda steep
December 5, 2024 at 5:32 PM
Topiary v0.8.0 -- Irresistible Ironwood -- is out! 🌳

New: Tree-sitter language injections (Markdown code blocks, OCaml in OCamllex and Menhir), much richer error reporting, better multi-line strings and a --check flag for CI.

github.com/topiary/topi...
October 1, 2026 at 9:06 PM
#AdventOfCode 2024 day 3 was quite trivial in #OCaml using ocamllex for reading the input, really feels like using the right tool for the right job!
December 3, 2024 at 7:19 AM
waffling over angstrom vs ocamllex+menhir
May 15, 2026 at 2:29 AM
I’m reaping the benefits of working on OSS once again.

I learned about menhir and ocamllex, and this week I already found an OCaml project at work that uses them both.

And thanks to my experience in personal time, it was quite easy to understand what’s going on.
Finished writing parser for my config language. Yes, it's that simple!

The lexer, on the other hand 😅

Still, I'm enjoying menhir and ocamllex so far, even tho the learning curve is kinda steep
December 6, 2024 at 9:31 AM
Yup 🙂 ! It took me some time but I finally did it.
#AdventOfCode 2024 day 2 part 2, implemented in
#OCaml using ocamllex (written and displayed here in @kde.org's awesome Kate ❤️) :
December 2, 2024 at 10:21 PM
Yes, .mll are ocamllex files. The syntax for each case in a lexing rule is a pattern expressed as a regexp followed by arbitrary OCaml code between curly brackets (there is no record here), the value of which will be returned by the function ocamllex will compile from the rule definition.
December 1, 2025 at 2:23 PM
You can find ocamllex's documentation on the OCaml website. It is a standard tool developed along the compiler and supported by the Stdlib:
ocaml.org/manual/5.4/l...
OCaml - Lexer and parser generators (ocamllex, ocamlyacc)
ocaml.org
December 1, 2025 at 2:26 PM
C'est du OCaml standard, juste un peu enveloppé dans du ocamllex pour se faciliter la vie pour le parsing.
ocaml.org/manual/5.4/l...
OCaml - Lexer and parser generators (ocamllex, ocamlyacc)
ocaml.org
December 1, 2025 at 2:28 PM
🎄 #AdventOfCode day 6 : no difficulty increase… yet.

Part 1 was trivial. Part 2 was less fun as I couldn't leverage ocamllex for parsing all the input in one pass. I had to read chars one by one and then transform the data. But once that's done it's simple number crunching :).

#OCaml 🐫 solutions:
2025/06 · main · Pablo Rauzy / Advent of Code · GitLab
code.up8.edu
code.up8.edu
December 6, 2025 at 9:33 AM
Treesitter OCaml already exists plus various supporting modes for menhir, ocamllex, dune and opam. github.com/tmcgilchrist...

Could use support for odoc and cram files ;-)
Add tree-sitter support for everything by tmcgilchrist · Pull Request #1 · tmcgilchrist/tuareg
This is an experiment to add tree-sitter support to Tuareg and support almost everything (except OCaml SMIE indentation). Uses the following tree-sitter grammars: OCaml: https://github.com/tree-si...
github.com
November 30, 2025 at 7:54 PM
🌳 Topiary now supports Language Injections, formatting "forests" of syntax trees embedded in one another—OCaml inside OCamllex, Rust/JSON blocks inside Markdown—without breaking the host layout.

Read all about how we leveraged Tree-sitter to make this happen: www.tweag.io/blog/2026-07...
Topiary: Formatting Forests
How Topiary can now format embedded languages in OCamllex and Markdown files, and how the injection system works under the hood.
www.tweag.io
July 9, 2026 at 2:48 PM
you know it really doesn't surprise me that alex would have a bug like this ^^
how are all parser generators so much better than the corresponding lexer generators (happy >> alex, menhir >>>>>> ocamllex)
April 2, 2025 at 12:17 PM
The complicated part is `ocamllex`/`menhir` support actually (although I think regular Vim would have the same problem).
There is a 5 year old PR on the vim-ocaml repository that'd fix it (unfortunately it is a breaking change, but 5 years is probably enough notice and time to merge?)
September 20, 2025 at 11:39 PM
I rewrote my solution for part 2 of 🎄 #AdventOfCode day 6 in pure 🐫 #OCaml since ocamllex was useless for parsing. The result is this nice and compact code (spoiler alert!):
December 6, 2025 at 2:11 PM
[some-subscribed-rss] New Post: Tweag I/O: Topiary: Formatting Forests, by https://tweag.io/blog/2026-07-09-topiary-formatting-forests/
July 9, 2026 at 5:10 PM
okay end of the experiment! @andreypopp had pitched to build an .mlx dialect where we could write JSX-style expressions in OCaml, and then @davesnx convinced me to actually do it.

I fought menhir, ocamllex, and I really don't want to see those again haha – but thanks to both…
November 21, 2024 at 5:32 AM
today is the day i finally learn ocamllex
November 21, 2024 at 5:32 AM
point-free ?

Ce qui rend mes codes courts là j'ai l'impression que c'est beaucoup l'utilisation de ocamllex pour le parsing (et aussi que y a des trucs qui mériteraient d'être sur deux ou trois lignes que je colle sur une seule pour faire joli haha ^^).
December 13, 2025 at 6:49 PM
#AdventOfCode #AdventOfCode2023
My solutions, in #OCaml using #ocamllex, can be found here:
code.up8.edu/pablo/aoc2023

I try to write efficient and elegant functional code, and to showcase as best as possible OCaml's standard library, avoiding other dependencies.
Pablo Rauzy / aoc2023 · GitLab
code.up8.edu
code.up8.edu
December 6, 2023 at 7:03 AM
#394636 vimPlugins.nvim-treesitter: revert ocamllex bump again
#394634 hoarder: set mainProgram
#394631 hcl2json: 0.6.6 -> 0.6.7
#394629 vimPlugins.cord-nvim: 1.0.0 -> 2.2.3
#394623 fzf: 0.60.3 -> 0.61.0
#394615 nss_latest: 3.109 -> 3.110
#394606 seagoat: 0.54.3 -> 0.54.4
March 31, 2025 at 12:05 AM