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 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id C4084BBC1 for ; Sat, 3 May 2008 07:13:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAAmRG0jVujhf/2dsb2JhbACrRg X-IronPort-AV: E=Sophos;i="4.27,430,1204498800"; d="scan'208";a="25779943" Received: from witko.kerneis.info ([213.186.56.95]) by mail4-smtp-sop.national.inria.fr with ESMTP; 03 May 2008 07:13:24 +0200 Received: from hokahe.kerneis.info ([82.224.215.18] helo=tatanka.kerneis.info) by witko.kerneis.info with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JsA3m-0003sL-LV; Sat, 03 May 2008 07:13:22 +0200 Received: from gabriel by tatanka.kerneis.info with local (Exim 4.69) (envelope-from ) id 1JsA2a-0001IT-J9; Sat, 03 May 2008 07:12:08 +0200 Date: Sat, 3 May 2008 07:12:08 +0200 From: Gabriel Kerneis To: "O'Leary, John W" Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Camlp4 lexers (>= 3.10) Message-ID: <20080503051208.GA4231@kerneis.info> Mail-Followup-To: "O'Leary, John W" , caml-list@yquem.inria.fr References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-SA-Exim-Connect-IP: 82.224.215.18 X-SA-Exim-Mail-From: gabriel@kerneis.info X-SA-Exim-Scanned: No (on witko.kerneis.info); SAEximRunCond expanded to false X-Spam: no; 0.00; camlp:01 lexers:01 lexer:01 camlp:01 parser:01 mll:01 lexer:01 mll:01 ocaml:01 syntax:01 interresting:01 wrote:01 caml-list:01 functions:01 ast:02 On Fri, May 02, 2008 at 01:15:36PM -0700, O'Leary, John W wrote: > Does anyone have an example that would show me how to connect my own > lexer to a Camlp4 parser? You can have a look at Ocsigen's xmlp4 module (allowing you to type xhtml code in quotations and get an AST): http://ocsigen.org/darcsweb/?r=ocsigen.current;a=tree;f=/xmlp4/newocaml Especially the files xmllexer.mll (using ocamlex, based on lexer.mll from ocaml source) and xhtmlparser.ml (written in revised syntax). The interresting parts are at the end of both files (look at functions Xmllexer.from_string = Xhtmlparser.parse, Xhtmlparser.xml_exp). Regards, -- Gabriel Kerneis