Skip to content

Compile artifacts for lrgrep; upgrade menhir version to 20231231#2880

Merged
ncik-roberts merged 10 commits intooxcaml:mainfrom
harrison6462:harrison6462-compile-artifacts-for-lrgrep
Aug 6, 2024
Merged

Compile artifacts for lrgrep; upgrade menhir version to 20231231#2880
ncik-roberts merged 10 commits intooxcaml:mainfrom
harrison6462:harrison6462-compile-artifacts-for-lrgrep

Conversation

@harrison6462
Copy link
Copy Markdown
Contributor

@harrison6462 harrison6462 commented Aug 1, 2024

This PR generates the necessary build artifacts to use lrgrep for better syntax error messages. This amounted to adding the --cmly and --inspection flags to the menhir stanza in ocaml/dune when building the parser. Lrgrep also requires menhir >= 20211128, so this updates the pin on menhir to enable that. It also makes sure to install the parser.cmly to the install directory so it's accessible for other projects.

When adding the --inspection flag to compile the parser, menhir will generate the inspection API. Some functions / types in this API will refer to types that are defined inside parser.mly (ex., Constant.t or let_binding), but menhir doesn't include these types in the autogenerated parser.mli file, and it causes the build to fail. To get around this, type declarations are moved into the helper parser_types.ml and parser_types.mli files (this is what lrgrep does).

Also, I'm not sure why flambda_parser.ml updated, or if that update was necessary. I included it in the PR just in case these changes from updating the menhir version are meaningful.

@harrison6462 harrison6462 marked this pull request as ready for review August 1, 2024 19:28
Copy link
Copy Markdown
Collaborator

@lpw25 lpw25 left a comment

Choose a reason for hiding this comment

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

Looks good to me, although it's not clear why you still need to do any copying for parser_types.ml. This PR needs performance testing before we merge it, just in case it has made the parser noticeably slower.

@ncik-roberts ncik-roberts changed the title Compile artifacts for lrgrep Compile artifacts for lrgrep; upgrade menhir version to 20231231 Aug 5, 2024
Copy link
Copy Markdown
Collaborator

@lpw25 lpw25 left a comment

Choose a reason for hiding this comment

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

Looks like there might be a superfluous line left over. Other than that it is good to go. As discussed offline, happy to merge first and then double check there isn't a performance regression.

@harrison6462 harrison6462 force-pushed the harrison6462-compile-artifacts-for-lrgrep branch from 1d3579d to 7c29b41 Compare August 5, 2024 17:21
@mshinwell mshinwell added the lexer/parser Changes to the lexer and parser label Aug 6, 2024
@ncik-roberts ncik-roberts merged commit e61d703 into oxcaml:main Aug 6, 2024
lukemaurer pushed a commit that referenced this pull request Oct 23, 2024
… to 20231231 (#2880)

* mend

* Removed accidentally included lrgrep build artifacts from build file

* Make sure parser.cmly gets put into the _install directory

* Removed unnecessary cat of parser_types because Menhir adds the interface they come from. Also, more clearly explained why the parser_types module is necessary

* Undo style changes to preprocess clause

* Undo style changes to preprocess clause

* Removed unnecessary preprocessor depedencies

* Update parser and parser types to account for changes from rebase

* Remove accidental modifications to .gitignore

* Re-added strategy simplified and fixed-exception flags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lexer/parser Changes to the lexer and parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants