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

Add support for prelude files #160

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

bclement-ocp
Copy link
Contributor

This improves Dolmen's prelude support by allowing to provide preludes as files, rather than as statements.

The prelude files are parsed separately from the main file, and can use a different language from the main file. The logic_file is reset to the appropriate file during statement generation to ensure that the typer always uses the right language.

Since a single pipe is now expected to potentially include statements from different languages, the additional_builtins in the typer is passed the current language as an additional argument, allowing to define language-specific additional builtins. Since this is already a breaking change, additional_builtins is also changed from a reference to a State key for consistency with the rest of Dolmen's API.

@bclement-ocp
Copy link
Contributor Author

(V0 messed up the lang inference exception handling, it is fixed now, sorry for the noise)

src/loop/typer_intf.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser_intf.ml Outdated Show resolved Hide resolved
Copy link
Owner

@Gbury Gbury left a comment

Choose a reason for hiding this comment

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

I think we're almost there: I left a few comments, but aside from that I think we're missing some kind of tests to check whether this is working as intended. The simplest would probably be to add a --prelude option to the dolmen cli and use it in a test, for instance to test a combination of the ae fpa prelude and a smtlib2 file ?

src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
@Gbury
Copy link
Owner

Gbury commented Jun 13, 2023

You might need to rebase on master to fix the CI runs (a commit I pushed earlier contained an obscure bug related to newlines in error messages on windows).

@bclement-ocp bclement-ocp requested a review from Gbury June 13, 2023 17:04
@bclement-ocp bclement-ocp force-pushed the bclement/prelude_files branch 3 times, most recently from 808150b to 929b753 Compare June 14, 2023 05:27
@bclement-ocp
Copy link
Contributor Author

@Gbury This should be good to go now

src/bin/options.ml Outdated Show resolved Hide resolved
doc/type.md Show resolved Hide resolved
src/loop/parser.ml Outdated Show resolved Hide resolved
This improves Dolmen's prelude support by allowing to provide preludes as
files, rather than as statements.

The prelude files are parsed separately from the main file, and can use a
different language from the main file. The `logic_file` is reset to the
appropriate file during statement generation to ensure that the typer always
uses the right language.

Since a single pipe is now expected to potentially include statements from
different languages, the `additional_builtins` in the typer is passed the
current language as an additional argument, allowing to define
language-specific additional builtins. Since this is already a breaking change,
`additional_builtins` is also changed from a reference to a `State` key for
consistency with the rest of Dolmen's API.
@Gbury Gbury merged commit 0555881 into Gbury:master Jun 15, 2023
bclement-ocp added a commit to bclement-ocp/alt-ergo that referenced this pull request Jun 15, 2023
Compatibility with the changes in Gbury/dolmen#160
bclement-ocp added a commit to OCamlPro/alt-ergo that referenced this pull request Jun 15, 2023
Compatibility with the changes in Gbury/dolmen#160
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