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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to