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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 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 8181CBBCA for ; Fri, 4 Apr 2008 16:02:05 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8BAD/R9UeDrhCRiGdsb2JhbACRTAEBAQ8mmW0 X-IronPort-AV: E=Sophos;i="4.25,604,1199660400"; d="scan'208";a="9198863" Received: from smeltpunt.science.ru.nl ([131.174.16.145]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Apr 2008 16:02:05 +0200 Received: from tandem.cs.ru.nl (tandem.cs.ru.nl [131.174.142.18]) by smeltpunt.science.ru.nl (8.13.7/5.24) with ESMTP id m34E1wHH005184 for ; Fri, 4 Apr 2008 16:02:00 +0200 (MEST) Received: from tews by tandem.cs.ru.nl with local (Exim 4.63) (envelope-from ) id 1JhmUQ-0007z4-1f for caml-list@yquem.inria.fr; Fri, 04 Apr 2008 16:01:58 +0200 From: Hendrik Tews To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Camlp4: example/parse_files.ml References: <18420.4901.506029.744640@tandem.cs.ru.nl> <1207236568-sup-3680@port-ext16.ensta.fr> <1207316266-sup-9155@ausone.inria.fr> Date: Fri, 04 Apr 2008 16:01:57 +0200 In-Reply-To: <1207316266-sup-9155@ausone.inria.fr> (Nicolas Pouillard's message of "Fri, 04 Apr 2008 15:40:36 +0200") Message-ID: User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.63 on 131.174.16.145 X-Spam: no; 0.00; hendrik:01 tews:01 tews:01 camlp:01 syntax:01 runtime:01 dynlink:01 syntax:01 runtime:01 dynlink:01 camlp:01 syntaxes:01 ocaml:01 functor:01 statically:01 "Nicolas Pouillard" writes: > Can I do the same with a syntax extention that is only > loaded at runtime via Dynlink? Assume a syntax extention X > that is only available at runtime and not at compiletime. > After loading X with Dynlink, all I can do is invoke the > callback of X, but this will add the grammar extension of X > to Camlp4.PreCast.Syntax. You can do it but you will to resort to some kind of registering of your extensions, as it's done in camlp4 for the default grammar. > Is there a way to obtain two functions parse_implem (as > above) that mix X with different syntaxes (eg Ocaml + X and > Revised + X)? For that, I believe, it would be necessary to > extract parse_implem from a syntax module such that it > survives clearing that Syntax. Yes but your extension X has to be a functor, then you can get X(OCamlOriginal), X(OCamlRevised). But this only works if I can statically link against X. There is no way to access the functor X through the Dynlink interface. With the standard interface of Camlp4 syntax extensions the loaded module applies X only to PreCast.Syntax. This could be repeated but one would have to clear PreCast.Syntax in between. Changing the Camlp4 interface one could chieve that X is applied to two or maybe three times (to PreCast.Syntax1 ... Syntax3). But how about the general case, where X is applied to n Syntax modules and n depends on the input? I believe this is impossible. Bye, Hendrik