An example of the use of lrgrep
  • OCaml 77.5%
  • Makefile 20.2%
  • Dune 2.3%
Find a file
2026-06-24 11:29:41 +02:00
src errors.lrgrep: fix non-exhaustive pattern matching. 2026-01-27 16:04:05 +01:00
test Add a new test case. 2026-01-27 16:04:37 +01:00
.gitignore .gitignore 2025-04-07 16:37:01 +02:00
dune-project Administrative files. 2025-03-20 09:26:12 +01:00
Makefile Fix [make cov] to work with lrgrep 0.3. Still not ideal. 2026-01-27 16:03:34 +01:00
README.md README: add link to the paper. 2026-06-24 11:29:41 +02:00

This example is described in the paper Mapping and explaining syntax errors with LRgrep by Frédéric Bour and François Pottier (JFLA 2026).

In this demo, the parser is compiled with the flags --table and --inspection. The first flag causes the parser to run in a relatively slower, interpreted mode. The second flag allows the parser's stack to be inspected at runtime. Both flags must be passed when one wishes to work with lrgrep.

If desired, one can compile a copy of the parser without these flags. Thus, one obtains a parser that runs in faster, compiled mode, which does not allow the stack to be inspected. One runs this fast parser first; if it fails, then one starts over and runs the slower parser on the same input, so as to produce a good syntax error message. This demo does not illustrate this two-phase process.