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.4 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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 2C261BBAF for ; Fri, 3 Oct 2008 23:58:58 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhwBAEoy5kjRVcbljmdsb2JhbACTIz4BAQEBCQkMBw8FoEBshn8BAg X-IronPort-AV: E=Sophos;i="4.33,358,1220220000"; d="scan'208";a="18166871" Received: from rv-out-0506.google.com ([209.85.198.229]) by mail1-smtp-roc.national.inria.fr with ESMTP; 03 Oct 2008 23:58:57 +0200 Received: by rv-out-0506.google.com with SMTP id f6so1749864rvb.3 for ; Fri, 03 Oct 2008 14:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=GlWxKh5wMs26bgMgNjNHC3a1wVfmJ114Zn3C5IjSrxo=; b=qmZewJye/HIVCkltwAv6RvwphKitNnoIHqE7xLO46kzdoCpV7gDblP0ggB6kNbps29 LWGwINXiDfEl42Nd1v38YGK6xuOHJ2LjZGtFgQSqO7vVgHUD1JFjLq5MML9qtnmKFlu2 46a3sNall8DevlEMeBp0xyZP/fmWU/ubb22qg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=QqP8HWNqUBwUelzQaZjKlxbAH08u0H5d/w38TiqqfBzZRWCj1pOIqUFPjdabe5kTIO j1E4nCaOopSzkAbJ1GgVAkP4bG/lBzFMvWp0GCZeCq03efSbPDPGcPuaCdkiyqWRnmPP OKxrH2JRyYCU0rfxOe+ArlJF1aOBR6sNk7ZZk= Received: by 10.141.193.1 with SMTP id v1mr1016096rvp.73.1223071136217; Fri, 03 Oct 2008 14:58:56 -0700 (PDT) Received: by 10.141.136.11 with HTTP; Fri, 3 Oct 2008 14:58:56 -0700 (PDT) Message-ID: <4a708d20810031458p39a2c9f7s7d37337fb32a7212@mail.gmail.com> Date: Fri, 3 Oct 2008 23:58:56 +0200 From: "Lukasz Stafiniak" To: "Dawid Toton" Subject: Re: [Caml-list] 'Compiler' module (was: embedding ocaml into a windows app: need gcc?) Cc: caml-list@yquem.inria.fr In-Reply-To: <48E68FD7.7040605@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1253374D-FC84-4394-99E5-46C02D26C54C@gmail.com> <48E68FD7.7040605@wp.pl> X-Spam: no; 0.00; lukasz:01 ocaml:01 gcc:01 ocaml:01 compiler:01 sig:01 val:01 val:01 python's:01 compiler:01 afaik:01 camlp:01 metaocaml:01 envy:98 wrote:01 On Fri, Oct 3, 2008 at 11:34 PM, Dawid Toton wrote: > >> I would like an OCaml support library that can compile and execute >> similar to JaveScript engines, but we don't have that in any practical >> form. >> > > I also need this and I'm thinking about something like this: > > module type Compiler = > sig > val parse : Context.t -> string -> (Context.t * AST.t) > val get_type : Context.t -> AST.t -> Type.t; > val eval : Context.t -> AST.t -> Context.t * (Type.t * > MarshalledValueOrSomething.t) > end > > Is it really so hard to have it in OCaml? I'm envy of Python's Compiler > module. > > It could solve some of my problems, in particular for my 'parallel-like' > evaluation ( > http://www.nabble.com/'Nondeterministic'-evaluation-wrt-exceptions-td18653998.html > ). After some experimentation I know that I need type information during > code transformation. I want to create a sort of interpreter. > > That Compiler module would also enable me to have an editor with graphical > representation of results intermixed with code (like Mathematica's > notebook). > > Where to look for suitable pieces of code? AFAIK camlp4 modules can't tell > me type of anything. Should I start digging in OCaml compiler sources? > You will be better off starting digging in MetaOCaml compiler sources :-)