Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured diagnostics for the compiler #13766

Open
wants to merge 19 commits into
base: trunk
Choose a base branch
from

Conversation

Octachron
Copy link
Member

See also ocaml/RFCs#45 and https://icfp24.sigplan.org/details/ocaml-2024-papers/16/Structured-diagnostics-for-the-OCaml-compiler for previous discussions .

A limitation of the current compiler diagnostics (error messages, warnings, time profile information and other compiler developer debugging output) is that it cannot be parsed easily and reliably by developer tools. This creates an impedance mismatch between the compiler and those tools that tend to resort to trying to parse manually compiler error message.

This PR proposes to fix this problem by adding to the compiler a machinery for building structured compiler diagnostics before displaying them in various formats.

This PR is probably best reviewed commit by commit:

  • the first eight commits slowly introduce the new machinery part by part
  • commit 9 to 14 converts the current compiler diagnostics to this new machinery (going through the error messages, the debugging outputs, then the toplevel, and finally the compiler configuration)
  • commit 15 adds a new tools for instrospecting the compiler diagnostics, and the following commit uses this new tools
    to export json-schema and adds the corresponding tests in the testsuite
  • the last commits 4 commits update the manual and the man pages.

@Octachron
Copy link
Member Author

Note that I have tested some quick prototypes for deserializers and a bridge between the proposed compiler diagnostic and the grace library at https://github.com/Octachron/sdiag-prototypes .

@johnyob
Copy link
Contributor

johnyob commented Jan 31, 2025

Note that I have tested some quick prototypes for deserializers and a bridge between the proposed compiler diagnostic and the grace library at https://github.com/Octachron/sdiag-prototypes .

Its lovely to see grace being used here :) I look forward to playing with this

@Octachron Octachron force-pushed the structured_diagnostics_full branch from 8edb2d8 to 8e07bd5 Compare February 3, 2025 12:17
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.

2 participants