Skip to content

WIP: Use ppx for ocaml codegen#929

Closed
emillon wants to merge 17 commits intomirage:masterfrom
emillon:ppx-codegen
Closed

WIP: Use ppx for ocaml codegen#929
emillon wants to merge 17 commits intomirage:masterfrom
emillon:ppx-codegen

Conversation

@emillon
Copy link
Copy Markdown
Contributor

@emillon emillon commented Oct 5, 2018

Hi,

This is more of an experiment before I go further on this.

I noticed that some OCaml code is generated and that is uses string interpolation.
I tried something different: define this code using metaquot, and pretty print using Pprintast.

While this does not ensure that the code compiles, it's a bit better since we at least ensure that it is a valid OCaml expression. On the other hand, this pulls ppx_tools_versioned (and so OMP and compiler-libs), so this can have library size implications (but if this is just for the CLI it might be OK).

What do you think? Is this a direction I should try to follow?

Note that this branch includes #928, so only the last commits are relevant.

cc @hannesm @samoht

Thanks in advance for your input!

@Drup
Copy link
Copy Markdown
Member

Drup commented Oct 6, 2018

You are moving some definitions away from their devices into another module. I'm not particularly fond of that. I think I would prefer to try to have self-contained devices as much as possible.

I'm surprised you didn't started that work by changing functoria. Most of the subtle code emission starts there.

@emillon
Copy link
Copy Markdown
Contributor Author

emillon commented Oct 9, 2018

Right, I'll first start by making private per-device modules. This will be easier to reexport in Mirage and test locally.

@samoht
Copy link
Copy Markdown
Member

samoht commented Mar 6, 2020

It's a good idea to simplify code generation, however I'm not particularly fond of introducing a ppx dependency in mirage before the ppx tooling is ready. Happy to revive once this is ready.

@samoht samoht closed this Mar 6, 2020
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.

3 participants