keywords: C, compilation, OCaml, AST
(it was not possible to use or create these keywords)
I’m facing the following situation:
I received an old C program that should be about 10-20 kLOC. I would like to implement it in OCaml and to improve it. But my knowledge of C language and tooling is very very basic.
Is there an easy and reliable solution to compile this C program to OCaml? At least, this should produce all signatures and enough fragments of C structures translated to OCaml expressions.
I imagine that compiling some C source should produce some AST. So, I also imagine that some translation/compilation to an OCaml AST should be possible (this is certainly the key question). Once landed in the OCaml world, I’m confident that I should get some OCaml expressions.
btw, I compile OCaml programs everyday to get some exe, but I’ve never played in the reverse direction or even inspected intermediary files.
What is the minimum set of commands required to produce an AST from a set of .ml files, and reversely to produce some .ml files from an AST file?