Skip to content

Integrate LRgrep error messages#2072

Open
let-def wants to merge 7 commits into
ocaml:mainfrom
let-def:with-lrgrep
Open

Integrate LRgrep error messages#2072
let-def wants to merge 7 commits into
ocaml:mainfrom
let-def:with-lrgrep

Conversation

@let-def
Copy link
Copy Markdown
Contributor

@let-def let-def commented May 23, 2026

This PR integrates LRgrep to generate syntax error messages. This change improves the quality and consistency of error reporting while, hopefully, making the error-handling logic more maintainable. Currently, this is an additive change that complements the existing parser without modifying or removing any existing behavior.

Main changes:

  • Declarative error specification: Added src/ocaml/preprocess/parse_errors.lrgrep, which defines syntax error messages in a clear, declarative format.
  • Coverage reporting: The make lrgrep-coverage target generates coverage.md, a report listing grammatical constructs that currently lack error messages, along with actionable hints for adding coverage.
  • Runtime integration: Copied the LRgrep runtime into src/ocaml/preprocess/, following the same vendoring pattern used for MenhirLib.

The declarative approach should make error messages easier to write, review, and maintain. The coverage tool gives us visibility into error-reporting gaps and guides incremental improvements.
While this PR is a strict addition, the long-term goal is to gradually replace parser components with a version more tightly integrated with LRgrep. This will significantly simplify the preprocessing pipeline and reduce boilerplate in the error recovery and explanation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant