News for hackers. Stuff that matters.
Re:C as an Intermediate Language (2012) by jjnoakes on Sunday May 15, 2016 @09:30PM (#11703694)
I am familiar with ocaml at a high level. I have written a few toy interpreters in it.

The c code it generates is basically the ocaml bytecode interpreter and the bytecode of my program.

Not what I was thinking of.

Re:C as an Intermediate Language (2012) by sn9 on Sunday May 15, 2016 @10:24PM (#11703854)
It also has a native code compiler and a foreign function interface.
Re:C as an Intermediate Language (2012) by jjnoakes on Sunday May 15, 2016 @10:43PM (#11703907)
It can generate portable and human readable C?

Can you link to some information about that?

Re:C as an Intermediate Language (2012) by loup-vaillant on Monday May 16, 2016 @03:21AM (#11704786)
Nothing of the sort.

But on the platforms it compiles to, Ocaml can generate object files that look like they came from C. I use this feature right now to integrate a compiler in an otherwise C++ project. Here's a link to the FFI documentation: http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html

But I run on Debian stable on x86-64. Not exactly an exotic platform.

Re:C as an Intermediate Language (2012) by jjnoakes on Monday May 16, 2016 @08:03AM (#11705744)
Is this not the bytecode embedded in C which I mentioned above?
Re:C as an Intermediate Language (2012) by loup-vaillant on Monday May 16, 2016 @07:20PM (#11710358)
No. It's native code, with the native runtime embedded in C.
Re:C as an Intermediate Language (2012) by jjnoakes on Tuesday May 17, 2016 @08:24AM (#11712979)
I see. So it gets me part of the way there; if only ocaml ran on my platforms.

Thanks.