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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id A25D8BBAF for ; Tue, 24 Jun 2008 16:39:14 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcAAHajYEiB1w3Nmmdsb2JhbACSbwEBAQEBCAUIBxEFn1k X-IronPort-AV: E=Sophos;i="4.27,696,1204498800"; d="scan'208";a="14477885" Received: from discorde.inria.fr ([192.93.2.38]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Jun 2008 16:39:14 +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 m5OEd68G019197 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 24 Jun 2008 16:39:14 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcAAHajYEiB1w3Nmmdsb2JhbACSbwEBAQEBCAUIBxEFn1k X-IronPort-AV: E=Sophos;i="4.27,696,1204498800"; d="scan'208";a="14477879" Received: from nougat.ucs.ed.ac.uk ([129.215.13.205]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Jun 2008 16:39:13 +0200 Received: from lmtp2.ucs.ed.ac.uk (lmtp2.ucs.ed.ac.uk [129.215.149.71]) by nougat.ucs.ed.ac.uk (8.13.8/8.13.4) with ESMTP id m5OEdC4W025701; Tue, 24 Jun 2008 15:39:12 +0100 (BST) Received: from [129.215.91.141] (dhcp-91-141.inf.ed.ac.uk [129.215.91.141]) by lmtp2.ucs.ed.ac.uk (8.13.8/8.13.7) with ESMTP id m5OEdBfQ010864; Tue, 24 Jun 2008 15:39:11 +0100 (BST) Message-ID: <486104FF.1080201@ed.ac.uk> Date: Tue, 24 Jun 2008 15:30:23 +0100 From: Jeremy Yallop User-Agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509) MIME-Version: 1.0 To: Nicolas Pouillard Cc: caml-list Subject: Re: [Caml-list] Custom lexer in Camlp4 References: <4860F097.1000701@ed.ac.uk> <1214317779-sup-8964@port-ext16.ensta.fr> In-Reply-To: <1214317779-sup-8964@port-ext16.ensta.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Edinburgh-Scanned: at nougat.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Scanned-By: MIMEDefang 2.60 on 129.215.13.205 X-Scanned-By: MIMEDefang 2.52 on 129.215.149.71 Content-Disposition: inline X-Miltered: at discorde with ID 4861070A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lexer:01 camlp:01 lexer:01 camlp:01 ocaml:01 grammars:01 functor:01 struct:01 persuade:98 wrote:01 caml-list:01 short:01 slightly:03 rebuild:03 seems:03 Nicolas Pouillard wrote: > Excerpts from Jeremy Yallop's message of Tue Jun 24 15:03:19 +0200 2008: >> Is there a way to replace the default lexer in Camlp4? I'd like to use >> (an extended version of) one of the OCaml grammars, but with a different >> lexer. > > You can rebuild (I mean functor application), your own camlp4 by giving > another Lexer module. Basically you will have to copy/paste the short > Camlp4.PreCast module (or a part of), by substituting Camlp4.Struct.Lexer > by your Lexer implementation. That's fairly heavy but works. Ok, I've built a slightly modified clone of PreCast. What's the best way to persuade Camlp4 to use it? The original PreCast seems fairly hardwired, e.g. in the Register module. Thanks for your help. Jeremy. -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.