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 8D69CBBAF for ; Fri, 3 Oct 2008 23:34:25 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoYAAKgs5kjUTWUFlGdsb2JhbACHG4xGAQEBAQkJDAcRBKgcgWg X-IronPort-AV: E=Sophos;i="4.33,358,1220220000"; d="scan'208";a="18165720" Received: from mx1.wp.pl ([212.77.101.5]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Oct 2008 23:34:25 +0200 Received: (wp-smtpd smtp.wp.pl 22048 invoked from network); 3 Oct 2008 23:34:22 +0200 Received: from phpdk6.ph.kcl.ac.uk (HELO [137.73.5.196]) (d0@[137.73.5.196]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 3 Oct 2008 23:34:22 +0200 Message-ID: <48E68FD7.7040605@wp.pl> Date: Fri, 03 Oct 2008 22:34:15 +0100 From: Dawid Toton User-Agent: Thunderbird 1.5.0.12 (X11/20080804) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: 'Compiler' module (was: embedding ocaml into a windows app: need gcc?) References: <1253374D-FC84-4394-99E5-46C02D26C54C@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [kYP0] X-Spam: no; 0.00; ocaml:01 gcc:01 ocaml:01 compiler:01 sig:01 val:01 val:01 python's:01 compiler:01 afaik:01 camlp:01 envy:98 compile:01 modules:02 ast:02 > 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? Dawid