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=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 88078BBAF for ; Sat, 24 Jan 2009 21:15:44 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnwBABsFe0lA6ba/kmdsb2JhbACTPT8BAQEBCQsKBw+mL44yAQMBA4VJgxA X-IronPort-AV: E=Sophos;i="4.37,318,1231110000"; d="scan'208";a="21978354" Received: from nf-out-0910.google.com ([64.233.182.191]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Jan 2009 21:15:43 +0100 Received: by nf-out-0910.google.com with SMTP id b11so870169nfh.13 for ; Sat, 24 Jan 2009 12:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=lSBoSLrfIjBoDCaoR6RE/itueEz2/nF4oF4h8dwwSnU=; b=PSypESfMWLc1fnyOAvo+xCMXj7Hb9WpTZeyEgMfVAQdMzC8oePT2PO3xECfdIlBTrp oevBH8fm2Ew+4hGYyUhYhVS1/CmIVnbaoV5u5TJmhu0OWzBY2Atz0bzzPUemvy4lNBTd w+Lkf/kxf6cPO/6uNKIuRlk/89FGuFSDCTRIg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=gKw3NXoG5OzeQnHO/xrDmJhlQR29Q1WfEfLCFnBVXUGc6BGfnennXT6xWresiwbASM I4iyf1eZ+8M+awYe7bnUaL6r4jHbjNYIDSkxoQWschOFeIAhDhWagyV0sK3PfMzjLIWK U+QDu5ftF7misAaivxjBOTfGlPjz1IQNJ7Iok= MIME-Version: 1.0 Sender: mikkelfj@gmail.com Received: by 10.210.120.7 with SMTP id s7mr317914ebc.184.1232828143335; Sat, 24 Jan 2009 12:15:43 -0800 (PST) Date: Sat, 24 Jan 2009 21:15:43 +0100 X-Google-Sender-Auth: 9d54e01b00c46560 Message-ID: Subject: camlp4 compilation model From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= To: "O'Caml Mailing List" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; camlp:01 compilation:01 model:01 mikkel:01 rgensen:01 mikkel:01 camlp:01 ocaml:01 ocaml:01 syntax:01 compiler:01 syntax:01 compilation:01 preprocessor:01 precisely:01 Hi, I've put camlp4 on the backburner, but I think it is useful to know it a bit better, especially because several libraries are using it. a) I understand you can write a cryptic ocaml program that effectively builds and AST from whatever grammar you decide by applying camlp4. b) I also understand that camlp4 it has a built in ocaml syntax that you can extend, and therefore use as camlp4 as a prepreprocessor to the ocaml compiler as part of the build process. In a) it makes sense that a library can embed (link with) camlp4 logic to parse strings without the enduser needing to refer to camlp4 in the build process. In b) you would normally require the user to apply the preprocessor to the source code as part of the build process. But know my question: It seems that an enduser program can link with a camlp4 enhanced library and magically have its syntax extended without adding camlp4 to the build process (once the library has been built). For example the bitstring library introduces the bitmatch syntax. Is this correct understood, and how does that work? One reason I put camlp4 on hold was precisely that added compilation complexity, but if it can be hidden in a library, it is an entirely different situation. Regards, Mikkel