-
Notifications
You must be signed in to change notification settings - Fork 37
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
Update ppx-elpi to work with current Elpi API and construct encoding of OCaml AST using it #179
base: master
Are you sure you want to change the base?
Conversation
A couple of implementation details that I was confused about while updating your ppx:
To make things typecheck, I removed these. I am not sure if this is because the API has changed, or whether I'm doing something wrong and changing the embedding. Finally, I haven't updated the mapper and traversal code to do something smarter than generating string literals. I guess I can add this in once I've confirmed what I've done so far makes sense. |
Wow! Amazing! I won't have time to look into this carefully before Tuesday, but I'm sincerely bluffed and looking forward to look at the code. |
The way for creating this conversion with the current API would be Line 386 in e8b50c7
but I then guess one should declare it in builtins (as for string, int, ...) and finally provide a couple APIs to link chars to strings. I frankly don't recall what I had to add chars, possibly just because ocaml has it. |
I was hitting the value-restriction, I think this is why I added the separate combinators. If you are not, I'm all for any other solution based on full conversions. |
These are still there in the I'll look into the code ASAP. |
Forgot to put @thierry-martinez in the loop, he might be interested as well. |
Okay, looking at the failing tests, I realise my updates are still missing a few details --- the generated code for the OCaml ast compiles, but ppx_elpi is still fairly incomplete and fails on the test-cases. I'm currently working on gradually fixing the failing tests one by one. Will push my changes as I progress; hopefully once the tests compile again, ppx_elpi will be roughly complete. |
Also, there's some part of the prelude I think I provide that is ill-formed and causes elpi to reject the whole string-- maybe the root cause is the incorrect choice of constant for the mapper src: |
I'm sorry I had no time to look into this last week. If we agree on a no-rebase rule, I may push comment or easy fixes on your branch directly. Would that be fine for you? |
Yes, sure, I'd be more than happy to await your changes. |
@Gopiandcode I have to suspend my activity on this branch. The status is the following:
The first order part seems OK. The ppx for ocaml now works as before, see The HO part (when one declares binders and context) needs more work, since:
|
where only CPred can have contextual arguments
@manmatteo I just rebased this branch. Unfortunately it still does not suppord mutual datatypes, and looking at why3, terms, patterns and match_branches are mutual. So I need to fix that first. The I think we can have a chat and see how to apply this to why3 |
Generating via ppx would be great! In addition to the mutual recursion, there's also the fact that in Why3 patterns bind variables in the branch but no explicit binder is present, so I had to add one. I'm not sure if there's some extra care needed to make the ppx aware of this. |
Thanks for the heads up. The ppx lets you override the code for each constructor, I guess we need to override the one for pattern matching branches, synthesize the binders, and call the generated code on the "fake" term. Similarly, on readback, we have to override the generated code, eat up the binders, and pass the ball to the generated code. |
Hi @gares ! Following up from our discussion earlier, I've now managed to update your original implementation of ppx to the point where it now works with the current branch.
Certain tests fail, for reasons that I'm not fully sure about, but the produced code does compile at least.
This pull request is likely not in a stage to be merged, hence why I've left it as a draft, but I think it serves as a good point to discuss the implementation.