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 backend plugin support #213

Merged
merged 5 commits into from
May 25, 2022
Merged

Add backend plugin support #213

merged 5 commits into from
May 25, 2022

Conversation

AltGr
Copy link
Contributor

@AltGr AltGr commented Mar 4, 2022

Implements #209.

@denismerigoux denismerigoux added ✨ enhancement New feature or request 🔚 backends Backend runtime or code generation 🔧 compiler Issue concerns the compiler labels Mar 6, 2022
@denismerigoux denismerigoux added this to the Catala v1.0 milestone Mar 6, 2022
compiler/utils/cli.ml Outdated Show resolved Hide resolved
@denismerigoux denismerigoux marked this pull request as draft March 6, 2022 16:47
@AltGr
Copy link
Contributor Author

AltGr commented May 5, 2022

What should I do with this ? I propose the following:

  • remove patch 9da75f7 which contains just demo plugins (esp. the python one is of no interest since the backend is already built-in !) ; another PR to re-add the jsoo plugin after a little cleanup should be fine
  • rebase the rest and merge ? In particular a212d52 has some refactorings that are already conflicting and will get worse as time goes
  • if more debate is needed on plugins, maybe rebase a212d52 as a separate PR. I'll in any case have to extend the debug_printf functions for consistency across the various printing functions ; nothing difficult but it should be done and merged quickly to avoid losing time on conflict resolution :)

@AltGr
Copy link
Contributor Author

AltGr commented May 10, 2022

Rebased ; the first patch should be fine, the second adding the demo plugins needs some cleanup (removing the dummy python plugin, decide where/how we put the jsoo one, add it to the normal build path…)

@AltGr AltGr changed the title Draft: add backend plugin support Add backend plugin support May 12, 2022
@AltGr AltGr marked this pull request as ready for review May 12, 2022 09:25
@AltGr AltGr force-pushed the plugin-support branch 2 times, most recently from 8ab6b8f to f75ae06 Compare May 12, 2022 10:27
AltGr added 4 commits May 19, 2022 10:40
- one that is just the same as the python backend
- one that is a quick'n'dirty call to js_of_ocaml on top of the ocaml backend to
  generate js files

Use `make plugins` to test them. They are only expected to be useful as
demonstrations of how to write plugins.
Makefiles shouldn't sudo
@AltGr
Copy link
Contributor Author

AltGr commented May 19, 2022

Rebased, I think it should be OK now, and the two plugins are properly advertised as examples.

Copy link
Contributor

@denismerigoux denismerigoux left a comment

Choose a reason for hiding this comment

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

It looks good to me code-wise but I think this plugin system is lacking some high-level documentation.

  1. Can you define a plugin.mld file in compiler/plugins ? Would this file be showed in the odoc output ?
  2. Can you write in CONTRIBUTING.md a guide on how to define a new backend plugin and make it work ?

@AltGr
Copy link
Contributor Author

AltGr commented May 20, 2022

I'll do that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔚 backends Backend runtime or code generation 🔧 compiler Issue concerns the compiler ✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants