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 p9OBoVeC007054 for ; Mon, 24 Oct 2011 13:50:31 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokBAPVPpU5KfVK2kGdsb2JhbABDqQoIIgEBAQEJCQ0HFAQhgWUJAQEBAQIBEgIsARsdAQMBCwYFAwEHOyIBEQEFARwGNYdellIKi0+CYIRSPYhuAgUKiDYElAmNLz2DcQ X-IronPort-AV: E=Sophos;i="4.69,398,1315173600"; d="scan'208";a="125576493" Received: from mail-wy0-f182.google.com ([74.125.82.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 24 Oct 2011 13:50:25 +0200 Received: by wyi40 with SMTP id 40so10724833wyi.27 for ; Mon, 24 Oct 2011 04:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HGVBzMGRyWRgKc5Y6ZG//ao7Wrcbj9snuOd+xP5Q+Uo=; b=Y8DnvQETESqZXliB4xYUMLxDL0nquAi+sRMzRVcWa2zUcTQE/K7ZKo8AO2DODY9//S XB3HNqNsO4S0rbT2hoSpjw6uGOJ1HWhGQs8HimfU+zroPYjOud0/WcHIRAInL/ndRRKP zNys+4vSCwng1raSEWiNpnL23uh1IjN/0WNoE= MIME-Version: 1.0 Received: by 10.216.138.209 with SMTP id a59mr6979557wej.94.1319457025404; Mon, 24 Oct 2011 04:50:25 -0700 (PDT) Received: by 10.216.73.131 with HTTP; Mon, 24 Oct 2011 04:50:25 -0700 (PDT) In-Reply-To: <4EA54BD0.8090009@inria.fr> References: <4EA54BD0.8090009@inria.fr> Date: Mon, 24 Oct 2011 13:50:25 +0200 Message-ID: From: Diego Olivier Fernandez Pons To: Xavier Leroy Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016e6d58fcd4bb0df04b00a0715 Subject: Re: [Caml-list] How to write an efficient interpreter --0016e6d58fcd4bb0df04b00a0715 Content-Type: text/plain; charset=ISO-8859-1 Caml-list, Xavier Leroy wrote > Compiling to bytecode is probably overkill. I think that writing my own bytecode interpreter is looking for trouble. Same for compiling to an existing bytecode. The language being a kind of SQL, most of the work is to properly execute the comprehensions (= queries). For instance range numbers = 0 .. 100; {int} sqrtLessThan [k in numbers] = { x | x in numbers : x * x <= k }; There are smarter ways to implement this than a double loop 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. Diego Olivier --0016e6d58fcd4bb0df04b00a0715 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable =A0 =A0 =A0Caml-list,

Xavier Leroy wrote
> = Compiling to bytecode is probably overkill.

I = think that writing my own bytecode interpreter is looking for trouble. Same= for compiling to an existing bytecode.

The language being a kind of SQL, most of the work is t= o properly execute the comprehensions (=3D queries).

For instance

=A0 =A0 =A0range numbers =3D 0 .. = 100;
=A0 =A0 =A0{int} =A0sqrtLessThan [k in numbers] =3D { x | x in numbers= : x * x <=3D k=A0};

There are smarter ways to = implement this than a double loop

I was rather thi= nking 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.


=A0 =A0 =A0 =A0 Diego Olivier
--0016e6d58fcd4bb0df04b00a0715--