From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p9OCXYO9008931 for ; Mon, 24 Oct 2011 14:33:34 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ak0JAJFapU7VuiYS/2dsb2JhbABDqAKBEIEFgW4BAQUMJgFGEAsYHBIUGDGIFbMVh19hBKVm X-IronPort-AV: E=Sophos;i="4.69,398,1315173600"; d="scan'208";a="125589097" Received: from solaria.dimino.org ([213.186.38.18]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Oct 2011 14:33:29 +0200 Received: by solaria.dimino.org (Postfix, from userid 1000) id 511358004E; Mon, 24 Oct 2011 14:33:29 +0200 (CEST) Date: Mon, 24 Oct 2011 14:33:29 +0200 From: =?iso-8859-1?Q?J=E9r=E9mie?= Dimino To: Diego Olivier Fernandez Pons Cc: caml-list@inria.fr Message-ID: <20111024123329.GC20070@solaria.dimino.org> Mail-Followup-To: Diego Olivier Fernandez Pons , caml-list@inria.fr References: <4EA54BD0.8090009@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] How to write an efficient interpreter Hi, On Mon, Oct 24, 2011 at 01:50:25PM +0200, Diego Olivier Fernandez Pons wrote: > I was rather thinking of translating on-the-fly into Caml code and letting > Caml do the job. Is that technically possible (rewriting a toplevel ? a > CamlP4 grammar ?). If so guess I would have to license the Caml compiler > from the INRIA. You can link with the toplevellib and use the Toploop module which provides functions for executing an OCaml AST. To create the AST you can for example write a parser for your language with Camlp4 and translate it using the Camlp4_import module. Note that you still need to have standard library cmi's at runtime. Also you can only compile your interpreter in bytecode. Cheers, -- Jérémie