From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id AEE9EBBC4 for ; Thu, 5 Mar 2009 21:39:28 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AioHAKvHr0nUnwckZmdsb2JhbACCHpJjDQsDBQkPBsJjhAgG X-IronPort-AV: E=Sophos;i="4.38,308,1233529200"; d="scan'208";a="36156962" Received: from relay.ptn-ipout02.plus.net ([212.159.7.36]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 05 Mar 2009 21:39:05 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai8FADTHr0nUnw6T/2dsb2JhbACCHtYBhAgG Received: from ptb-relay03.plus.net ([212.159.14.147]) by relay.ptn-ipout02.plus.net with ESMTP; 05 Mar 2009 20:39:04 +0000 Received: from [87.112.234.120] (helo=leper.local) by ptb-relay03.plus.net with esmtp (Exim) id 1LfKLP-0007a0-W0 for caml-list@yquem.inria.fr; Thu, 05 Mar 2009 20:39:04 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] stl? Date: Thu, 5 Mar 2009 20:44:29 +0000 User-Agent: KMail/1.9.9 References: <91a2ba3e0903031340wcdc976cp52522eb35f7ccb73@mail.gmail.com> <200903050106.34700.jon@ffconsultancy.com> <20090305090914.GC24055@annexia.org> In-Reply-To: <20090305090914.GC24055@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903052044.29147.jon@ffconsultancy.com> X-Plusnet-Relay: 5c07447b1c19d3044d43087d8deab886 X-Spam: no; 0.00; stl:01 ocaml:01 camlp:01 camlp:01 wiki:01 inference:01 ocaml's:01 run-time:01 -dlambda:01 ocamlc:01 -dlambda:01 lambda:01 lambda:01 seq:01 2009:98 On Thursday 05 March 2009 09:09:14 Richard Jones wrote: > On Thu, Mar 05, 2009 at 01:06:34AM +0000, Jon Harrop wrote: > > Indeed. Which raises the question of how I should put an OCaml front > > end onto HLVM... > > Use the output of camlp4 (the AST). It's reasonably well documented > in the camlp4 wiki. I can parse it easily enough. The type inference and checking is the hard part. I'm afraid that OCaml's current implementation might not be very useful in that respect anyway if it removes types too soon and makes assumptions about the run-time representation. Perhaps the output of -dlambda would be suitable: $ cat >a.ml type t = A of int | B of int | C of int;; function A n -> n | B n -> 1+n | C n -> 2+n;; $ ocamlc -dlambda a.ml -o a 2>a.lambda $ cat a.lambda (setglobal A! (seq (function param/72 (switch* param/72 case tag 0: (field 0 param/72) case tag 1: (+ 1 (field 0 param/72)) case tag 2: (+ 2 (field 0 param/72)))) (makeblock 0))) Is this format documented anywhere? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e