From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 75C59BBAF for ; Mon, 28 Jun 2010 16:03:54 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AngBAK9IKExKfVK0kGdsb2JhbACSTTCMKggVAQEBAQkJDAcRAx+wFQqBf4UILohTAQEDBYUfBIQHgl6HUQ X-IronPort-AV: E=Sophos;i="4.53,497,1272837600"; d="scan'208";a="54093512" Received: from mail-wy0-f180.google.com ([74.125.82.180]) by mail2-smtp-roc.national.inria.fr with ESMTP; 28 Jun 2010 16:03:54 +0200 Received: by wyj26 with SMTP id 26so1239674wyj.39 for ; Mon, 28 Jun 2010 07:03:53 -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:reply-to :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=60dgGO0Kk1Oz/I8DdkDmF2fym8c7aDNC6mqu6AoQulw=; b=AqUO4m37KlYcZohNFhhKADGNB4Ejg5Np7SwI8gWzvjXPs/aKCb4DyNlxf8Fxpi7XjZ lcKZoN5a+6UeD16HkvKR6vuy5xmyHlcVuRSBJcuwW2xUe7HeqDZGIETOqiSxNs3ixV39 TFjl+ZxEuFhEqq+4JMJh1SLEFu++nDdD6uSmc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=W8OkaYURiPmjGg595jIuEvajKfKzqK003eboqGGfwKW3McJQqJ/vCmUzHJ97Yu6ZtF UvF2nBwY4jI0pxsDloS9oCboIQ7P4XjyNj5rvG178jZsjfKibgJjf08O9sscU9gyjpXU aYrUb7q7n2NYzVTgSc37MtNaFDw3/76tCfmk0= Received: by 10.216.154.7 with SMTP id g7mr8105665wek.30.1277733826631; Mon, 28 Jun 2010 07:03:46 -0700 (PDT) Received: from [255.255.255.255] (sd-11284.dedibox.fr [88.191.62.226]) by mx.google.com with ESMTPS id m78sm1085238weq.40.2010.06.28.07.03.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 28 Jun 2010 07:03:45 -0700 (PDT) Message-ID: <4C28ABA8.2050807@gmail.com> Date: Mon, 28 Jun 2010 16:03:20 +0200 From: Martin Potier Reply-To: martin.potier@gmail.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100624 Shredder/3.0.5 MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Caml typed AST References: <4C0EB650.6080603@gmail.com> <940CD13B-5569-4B4C-9616-7AE9132EC114@gmail.com> In-Reply-To: <940CD13B-5569-4B4C-9616-7AE9132EC114@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; ocaml:01 transforming:01 toploop:01 typemod:01 beginner's:01 ocaml:01 bug:01 46,:98 beginners:01 wrote:01 typing:01 typing:01 caml-list:01 caml-list:01 bin:01 Thank you for your answer. I still have no clue how to use it, or even pretty-print from that AST. Is there a simple way to do so ? Is there a documentation on using basic caml elements, like building an AST from a string of ocaml code, typing, type-checking, transforming and prettyprinting from this AST ? -- Martin Le 09/06/2010 00:46, Ruslan Ledesma Garza a écrit : > Hello Martin, > > Looking at toploop.ml in 3.11.1, a line reads: > > let (str, sg, newenv) = Typemod.type_structure oldenv sstr Location.none > > I believe str contains the AST you are looking for. > > Best regards, > Ruslan. > > On Jun 8, 2010, at 11:29 PM, Martin Potier wrote: > >> Dear List, >> >> I have a school research assignment about defunctionalization. >> >> I'd like to implement a defunctionalization algorithm for Caml, using >> Caml, that's why I'd like to know if there is a way to retrieve a typped >> AST from Caml. >> >> I had a look at the option -dparsetree of the Caml interpreter, but it >> doesn't fit my need for two reasons : first it's not typped, and second >> it's not easily reusable. >> >> In a way, I just want to "plug in" right after the typing of the Caml >> AST in order to reuse it. >> >> Does anyone know the Caml source well enough to point me to a place >> where a function uses a typped AST ? >> >> -- >> Martin Potier >> >> _______________________________________________ >> Caml-list mailing list. Subscription management: >> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >> Archives: http://caml.inria.fr >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >