Skip to content

Externals Extraction from .cmt Files #3699

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

Merged
merged 20 commits into from
Mar 25, 2025

Conversation

spiessimon
Copy link
Contributor

This PR adds a command line tool to the compiler that can be used to extract shape information about the external declarations in .cmt files. The tool is built as extract_externals.opt.

The impact on the rest of the compiler from this PR is minimal. To reduce code duplication, the environment reconstruction in envaux.ml is parameterized by a flag whether it show allow or disallow missing modules in the reconstruction of the environment. Apart from this change, this PR only adds functionality in new files.

The externals extraction. The extraction takes as input .cmt files along with a sequence of -I, -H, and -open flags that would be used for compilation. It then outputs a sexp expression that lists the external declarations that it found in the .cmt files along with information about their shapes.

Copy link
Contributor

@ccasin ccasin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. I did not carefully review the contents of extract_externals/, since it was reviewed elsewhere earlier.

One additional remark: I think it would be good to put either a readme file in that directory or a comment in extract_externals.mli explaning what it is.

If, in the interest of getting this into our next release, you want to address any of these comments in a future PR, that's fine, just merge.

@spiessimon
Copy link
Contributor Author

I added a readme file that explains the basic usage of the extraction. I would postpone fine tuning the readme to a future PR.

@spiessimon spiessimon merged commit 09a3597 into ocaml-flambda:main Mar 25, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants