From: Kuba Ober <kuba@mareimbrium.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] - Convert Caml to C/C++, C#, PHP, etc -
Date: Thu, 9 Oct 2008 17:47:58 -0400 [thread overview]
Message-ID: <200810091747.59342.kuba@mareimbrium.org> (raw)
In-Reply-To: <20081003153921.9bc91e12.mle+ocaml@mega-nerd.com>
On Friday 03 October 2008, Erik de Castro Lopo wrote:
> axllaruse wrote:
> > I would like to convert all the MTASC open source project to
> > C/C++ or PHP.
>
> Sorry, but you're crazy.
>
> MTASC is a compiler and compilers are one of the tasks that
> Ocaml does better that all of the languages you mention.
>
> Converting the MTASC compiler to a less capable language (yes, C++
> is less capable) would be an exercise in extreme Greenspunning:
Um, since Ocaml can be compiled to bytecode and said bytecode executed
by an interpreter written in C, that's sorta-kinda el-cheapo conversion
right there. One can work backwards.
1. Get the bytecode compiler to output C that resembles what would be
called in the interpreter loop. That still uses all of the interpreter's
innards, just removes the interpreter loop.
2. Tweak the bytecode compiler to output higher-level C stuff where
applicable. That way you can get C that looks more like C and less like
bytecode-primitives-called-in-C.
(2) is probably the hard part as it involves sweeping modifications to the
compiler. (1) is easy, you can do it on raw bytecode without touching
the compiler, although it'd be a good exercise to get to know the compiler.
Side note: is there an Ocaml bytecode-compiler written in Ocaml somewhere?
It'd be easier to work on than said compiler written in C/C++.
Cheers, Kuba
next prev parent reply other threads:[~2008-10-09 21:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 4:03 axllaruse
2008-10-03 4:18 ` Erik de Castro Lopo
2008-10-03 5:33 ` axllaruse
2008-10-03 5:39 ` Erik de Castro Lopo
2008-10-03 8:06 ` Sylvain Le Gall
2008-10-03 9:56 ` [Caml-list] " Roberto Bagnara
2008-10-09 21:47 ` Kuba Ober [this message]
2008-10-09 21:57 ` Erik de Castro Lopo
2008-10-10 4:26 ` Jon Harrop
2008-10-10 3:30 ` Erik de Castro Lopo
2008-10-10 4:55 ` Jon Harrop
2008-10-10 14:25 ` Mauricio Fernandez
2008-10-10 12:37 ` Kuba Ober
2008-10-10 13:38 ` Basile STARYNKEVITCH
2008-10-03 16:57 ` David Teller
2008-11-17 14:30 ` Nicolas Cannasse
2008-10-03 9:50 ` Erkki Seppala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200810091747.59342.kuba@mareimbrium.org \
--to=kuba@mareimbrium.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox