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 D5E96BBCA for ; Thu, 3 Apr 2008 17:34:15 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAAiW9EfAXQIm/2dsb2JhbACKaKE2 X-IronPort-AV: E=Sophos;i="4.25,599,1199660400"; d="asc'?scan'208";a="10384496" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 03 Apr 2008 17:34:15 +0200 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 m33FYAto024552 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 3 Apr 2008 17:34:15 +0200 X-IronPort-AV: E=Sophos;i="4.25,599,1199660400"; d="asc'?scan'208";a="11032615" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail3-relais-sop.national.inria.fr with SMTP; 03 Apr 2008 17:34:15 +0200 Received: by ausone.inria.fr (sSMTP sendmail emulation); Thu, _d Apr 2008 17:32:55 +0200 From: "Nicolas Pouillard" Cc: caml-list Subject: Re: [Caml-list] Camlp4: example/parse_files.ml To: Hendrik Tews References: <18420.4901.506029.744640@tandem.cs.ru.nl> In-Reply-To: <18420.4901.506029.744640@tandem.cs.ru.nl> Date: Thu, 03 Apr 2008 17:32:55 +0200 Message-Id: <1207236568-sup-3680@port-ext16.ensta.fr> User-Agent: Sup/git Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=-1207236775-773366-76375-6236-1-="; micalg="pgp-sha1" MIME-Version: 1.0 X-Miltered: at discorde with ID 47F4F8F2.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 hendrik:01 parser:01 functor:01 camlp:01 ocaml:01 functor:01 syntax:01 parser:01 syntax:01 functors:01 callbacks:01 iter:01 callbacks:01 functors:01 X-Attachments: cset="UTF-8" type="application/pgp-signature" name="signature.asc" name="signature.asc" --=-1207236775-773366-76375-6236-1-= Content-Type: text/plain; charset=UTF-8 Excerpts from Hendrik Tews's message of Thu Apr 03 01:13:41 +0200 2008: > Hi, > > I have a few questions to the parse_files example. > > The example starts with building the parser and printer via the > following functor application > > module Caml = > Camlp4.Printers.OCaml.Make > (Camlp4OCamlParser.Make > (Camlp4OCamlRevisedParser.Make > (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation))));; > > > 1. Can I omit the printer functor if I am only interested in > parsing files (and not printing) and simplify to > > module Caml = > Camlp4OCamlParser.Make > (Camlp4OCamlRevisedParser.Make > (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation))) Yes I think so. > 2. Ast, Gram, Quotation come from Camlp4.PreCast. Right. > Do I miss > something if I simplify further to > > module Caml = > Camlp4OCamlParser.Make > (Camlp4OCamlRevisedParser.Make(Camlp4.PreCast.Syntax)) You are applying original and revised parser, so if the current parser is empty that's ok. Otherwise the extension can fail. > 3. I looked into the registration of syntax extentions (Register > functors) and how the syntax extention callbacks are called > in Register.iter_and_take_callbacks. I have the impression > that in camlp4 not the above nested functor application is > performed but the Make functors are sequentially applied to > the same Syntax functor. Therefore, can I further simplify to > > module Caml = Camlp4.PreCast.Syntax > let () = > let module M1 = Camlp4OCamlRevisedParser.Make(Caml) in > let module M2 = Camlp4OCamlParser.Make(Caml) > in > () Right, assuming you're starting with an empty grammar. -- Nicolas Pouillard aka Ertai --=-1207236775-773366-76375-6236-1-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkf0+KcACgkQj+FCNw9dwLkwmQCdFxTAC8ANngnmPVM6h87vKnxN 8KMAoIsiMrWnNTMLcL5x7yXbFdq4MOhu =DNoo -----END PGP SIGNATURE----- --=-1207236775-773366-76375-6236-1-=--