caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yotam Barnoy <yotambarnoy@gmail.com>
To: Evgeny Roubinchtein <zhenya1007@gmail.com>
Cc: Hendrik Boom <hendrik@topoi.pooq.com>,
	Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] off-brand use of ocaml bytecode
Date: Thu, 22 Dec 2016 11:00:53 -0500	[thread overview]
Message-ID: <CAN6ygOmPu05-jsa6DSW_zs+uFG3+6yf+Z8O+CRVWH1bmVzDqvw@mail.gmail.com> (raw)
In-Reply-To: <CAGYXaSbU9hPpGO11JsfAVov4sHt=tg-LduR5gi2LZ2ssUBtjWQ@mail.gmail.com>

Check out Stephen Dolan's Malfunction
(https://github.com/stedolan/malfunction). You essentially compile
down to OCaml's internal representation, and the compiler takes it
from there, making either bytecode or native binaries.

On Thu, Dec 22, 2016 at 10:48 AM, Evgeny Roubinchtein
<zhenya1007@gmail.com> wrote:
> I know there are people on this list who are way more qualified to answer
> these questions, but let me try.
>
> On Wed, Dec 21, 2016 at 8:12 PM, Hendrik Boom <hendrik@topoi.pooq.com>
> wrote:
>>
>> Are there ny tools available that could be used to generate ocaml
>> bytecode for other languages?
>
>
> I don't think you will get a definitive answer on this list.   Here is a
> thought experiment showing why.  Suppose J. Random Hacker decides to write a
> compiler from WhizBangLang to OCaml byte code.  Under the assumption that
> OCaml developers are not omniscient, the way they would learn about J.
> Random Hacker's efforts is if s/he either: a) announces the new language in
> some venue that OCaml developers watch or b) finds [what s/he believes are]
> bugs in the OCaml byte code interpreter and files bug reports against it.
> It isn't clear to me that our J Random Hacker must needs do either of those
> things.
>
>> If I were to do that, by hand or otherwise, how would I interpret or
>> compile it?
>
>
> The ocamlrun program, shipped with the OCaml distribution and documented at
> http://caml.inria.fr/pub/docs/manual-ocaml/runtime.html is the standard
> interpreter for the OCaml byte code.
>
> For the OCaml compiler, the byte code is a target (as opposed to a source or
> an intermediate representation), so the existing OCaml tool chain does not
> support compiling byte code, to the best of my knowledge (AFAIK projects
> like Bucklescript and js_of_ocaml use the OCaml front-end and intermediate
> representation, but supply a different compiler back end).
>
>> Would the ocaml run-time system we available -- things like the garbage
>> collector, I/O libraries, etc.
>
>
> I think that question is answered in the documentation of ocamlrun.   You
> probably will also want to peruse
> http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html and specifically the
> discussion of static and dynamic linking of C code with OCaml code.
>
>>
>> Is anyone else working of projects like this?
>
>
> I am not entirely certain what the intended antecedent of "this" is here.
> If "this" is "a compiler that targets OCaml byte code", then please see my
> answer above.  If you feel that the current design of "ocamlrun for standard
> primitives + the '-custom' flag to the OCaml compiler for non-standard
> primitives" is failing to address a need, then a description of the need
> that isn't being addressed would be a good starting point for discussion.
> ;-)
>
> Hope this helps
> --
> Best,
> Zhenya
>

  reply	other threads:[~2016-12-22 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22  1:12 Hendrik Boom
2016-12-22 15:48 ` Evgeny Roubinchtein
2016-12-22 16:00   ` Yotam Barnoy [this message]
2016-12-22 16:14   ` Gabriel Scherer
2016-12-22 22:18 ` [Caml-list] off-brand use of ocaml's lambda IR Hendrik Boom
2016-12-22 22:28   ` Gabriel Scherer

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=CAN6ygOmPu05-jsa6DSW_zs+uFG3+6yf+Z8O+CRVWH1bmVzDqvw@mail.gmail.com \
    --to=yotambarnoy@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=hendrik@topoi.pooq.com \
    --cc=zhenya1007@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).