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

Serialization of Coq's types. #44

Open
ejgallego opened this issue Dec 7, 2018 · 5 comments
Open

Serialization of Coq's types. #44

ejgallego opened this issue Dec 7, 2018 · 5 comments

Comments

@ejgallego
Copy link

This is just a suggestion, but IMHO it would make sense to implement a small Coq program that given an OCaml type [for example, constr_expr , the Coq's AST] would generate the corresponding .ts file, including constructors from sexp.

IMHO that should save a lot of time; but maybe you are using already some other automatic method.

@Ptival
Copy link
Owner

Ptival commented Dec 7, 2018

I agree. I wrote them manually because I had to get things going fast and dirty, but it's neither pleasant nor manageable.

Now that OCaml has ppx extensions, I wonder how hard it'd be to have it use this mechanism to do it? Or do you have any technical suggestion on how to achieve this? I'd love to generate those automatically.

@ejgallego
Copy link
Author

It should be "fairly easy", I am a bit busy right now but I would start from already existing projects that do similar things; basically you do a traversal on the AST and that is.

I am interesting doing this for both Python and TS, so keep me posted if you start something, if I do I'll ping you here too.

@ejgallego
Copy link
Author

Actually ppx is not even needed, we just a program that uses compiler-libs. Then, the basic scheme is very simple IMO:

let ast = Parse.interface foo in 
let typ_list = Ast_iterator that build the right type list in
output (convert typ_list)

@Ptival
Copy link
Owner

Ptival commented Dec 7, 2018 via email

@ejgallego
Copy link
Author

Hey congrats @Ptival !! I guess you'll have way better things to do than to hack OCaml.

Anyways I actually wrote already a very small shim, find it here at https://github.com/ejgallego/ocaml-ts

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

No branches or pull requests

2 participants