From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 134D5BC37 for ; Wed, 24 Feb 2010 22:36:10 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArQCAI8qhUvRVdzfkGdsb2JhbACRIYloCBUBAQEBBwsMBxMDH6xvgVmFIS2ISQEBAwWEbQQ X-IronPort-AV: E=Sophos;i="4.49,534,1262559600"; d="scan'208";a="53566026" Received: from mail-fx0-f223.google.com ([209.85.220.223]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Feb 2010 22:36:09 +0100 Received: by fxm23 with SMTP id 23so138799fxm.3 for ; Wed, 24 Feb 2010 13:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=87rbOn62STvw5i0gPNt62L466zSnsrlXOEnsA/0PfNk=; b=WuzaJS+iBsi1kPD5QHAaHOzXKMJpHxh/SEThbX+SA7R+chSxzM+n5A6VHcJmCaXyzj H+3R2KgJsNRAKJ9xaPTMLBl5ryzNMEd4PeqwCLWoSXohG3LWRy0eRUGMLk3qdPbIJkja UefrbZwVd/PCPoq09bNSmffZWS51sByUtzGfQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=TvC2K79lB6m98/fc2WqwItijtM3DGTBy+mdz3MrLrjYsWCAIjabCV/rTu1jKWUe0MN cAD9Se/ifAoF2ldz4n8iDl+lVx5BfszReBNJEYKBwjIt6HfyGhM2tjQCUFcJ/RI2OcFO 1zvk4Ljg2cqZPCRh3R/zBN+sqG1njoOcRcPa4= MIME-Version: 1.0 Received: by 10.239.149.8 with SMTP id h8mr49848hbb.10.1267047368060; Wed, 24 Feb 2010 13:36:08 -0800 (PST) In-Reply-To: References: Date: Wed, 24 Feb 2010 22:36:07 +0100 Message-ID: <4d1b2df21002241336w73c6d80ci561b245ec00ce4f8@mail.gmail.com> Subject: Re: [Caml-list] vm in ocaml From: Philippe Wang To: Joel Reymont Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocaml:01 ocaml:01 bytecode:01 bytecode:01 runtime:01 runtime:01 ocamlc:01 interprete:01 ocamlopt:01 ocamlc:01 prompts:98 javascript:98 wrote:01 caml-list:01 output:02 On Wed, Feb 3, 2010 at 4:47 PM, Joel Reymont wrote: > I have a translator from a Pascal-like trading language written in OCaml = and I need the output to run as a DLL embedded in a trading platform. > > I'm thinking of generating bytecode and have the user pass the path to th= e bytecode file to the DLL during initialization. > > I don't want to load source code into my runtime since I want to do a lot= of error checking on it to make sure the runtime experience is smooth. I d= on't want to ship ocamlc, etc. since I want to have a single executable. I'= m not sure if embedding OCaml (and thus a license!) is needed to generate O= Caml bytecode in my scenario, so the bytecode I'm talking about is my bytec= ode. > > I understand that a bit of C will be required to wrap the OCaml runtime i= n a DLL. I would prefer to stay with OCaml for the whole project which prom= pts my question... I understand that : - you want to generate some bytecode (with your own bytecode specs) from the Pascal-like language - interprete this bytecode with a VM written in OCaml but actually I don't quite understand your question :-/ > Has anyone used OCaml to write a virtual machine? Some people (including some colleagues of mine (and me), actually) have used OCaml to write an OCaml virtual machine. (I've heard someone say (indirectly) that we were not the first). It is an interesting exercise... for people who prefer writing in OCaml rather than in C. It's also interesting to run an OCaml VM in an OCaml VM ... in an OCaml VM, the last one being in OCaml compiled with ocamlopt or in C (or in Java [Cadmium] or in JavaScript [O'Browser], though we haven't tried), and all the previous one being in OCaml compiled with ocamlc. > How big is the OCaml runtime when bundled as a DLL or shared library? Sorry I've no idea for this question. --=20 Philippe Wang mail@philippewang.info