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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 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 AE76DBC6C for ; Sat, 15 Dec 2007 16:48:34 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHaGY0fAXQImh2dsb2JhbACQAgEBAQgKKYEUli8 X-IronPort-AV: E=Sophos;i="4.24,172,1196636400"; d="scan'208";a="5681004" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Dec 2007 16:48:34 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id lBFFmXx4029601 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 15 Dec 2007 16:48:34 +0100 X-IronPort-AV: E=Sophos;i="4.24,172,1196636400"; d="scan'208";a="6863404" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail3-relais-sop.national.inria.fr with SMTP; 15 Dec 2007 16:48:33 +0100 Received: by ausone.inria.fr (sSMTP sendmail emulation); Sat, _d Dec 2007 16:47:40 +0100 From: "Nicolas Pouillard" Content-Type: text/plain; charset=UTF-8 Cc: caml-list Subject: Re: [Caml-list] How to Create Sensible Debugging Information when Dynamically Typechecking Code Generated with camlp5 Quotations To: echinuz echinuz References: <606064.60999.qm@web60114.mail.yahoo.com> In-Reply-To: <606064.60999.qm@web60114.mail.yahoo.com> Date: Sat, 15 Dec 2007 16:47:40 +0100 Message-Id: <1197733590-sup-3933@ausone.local> User-Agent: Sup/0.3 X-Miltered: at discorde with ID 4763F751.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 ocaml:01 statically:01 runtime:01 deceptive:98 dynamically:01 typechecking:01 caml-list:01 essentially:02 checking:02 figuring:02 quotations:03 quotations:03 debugging:03 Note: Camlp4 give you locations relative to the entire program ;) Regards, Excerpts from echinuz echinuz's message of Fri Dec 14 22:22:23 +0100 2007: > I have a DSL that I embedded using quotations with camlp5. Essentially, there > are a number of features that are useful in ocaml, such as file io, that I > don't want to add to the language. Using quotations allows me to add these > features. The language, by itself, can be statically type checked, but since I > allow antiquotations I must type check at runtime. Unfortunately, I'm having > trouble figuring out a sensible way to add debugging information during type > checking. A typical program looks like this: > > let x=... in > let prog= <:prog< > embedded commands... > more embedded commands... > >> in > execute prog;; > > The problem with location information generated in camlp5 is that it gives the > location relative to the quote. I'm more interested in location information > relative to the entire program. One thought is to run the file through camlp5 > twice and generate location information using trick similar to __LOCATION__ > from pa_macro. However, since the first pass through expands the quotations, > the subsequent location information tends to be deceptive. > > Is there a good way to generate this location information? Or, more generally, > is there a better way to type check the resulting program? > -- Nicolas Pouillard aka Ertai