From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id CC746D176 for ; Mon, 1 Aug 2005 01:39:36 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6VNda2l013908 for ; Mon, 1 Aug 2005 01:39:36 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA25271 for ; Mon, 1 Aug 2005 01:39:35 +0200 (MET DST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6VNdXqH023098 for ; Mon, 1 Aug 2005 01:39:34 +0200 Received: from rosella (ppp11-151.lns1.syd7.internode.on.net [59.167.11.151] (may be forged)) by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id j6VNdVOv093361; Mon, 1 Aug 2005 09:09:31 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] buidlExpressionParser From: skaller To: Pietro Abate Cc: ocaml ml In-Reply-To: <20050731132119.GA368@pulp.anu.edu.au> References: <20050731132119.GA368@pulp.anu.edu.au> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-elUbg7L4+lPX+D0Oa3a2" Date: Mon, 01 Aug 2005 09:39:31 +1000 Message-Id: <1122853171.6779.134.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 X-Miltered: at concorde with ID 42ED6138.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42ED6135.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 grammar:01 parser:01 runtime:01 lexer:01 hmmm:01 regexps:01 combinator:01 nfa:01 ...:98 wrote:01 sourceforge:01 sourceforge:01 lex:01 X-Attachments: type="application/pgp-signature" name="signature.asc" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 --=-elUbg7L4+lPX+D0Oa3a2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2005-07-31 at 23:21 +1000, Pietro Abate wrote: > Hi all, >=20 > I'm trying to write a generic parser similar to the buidlExpressionParser > in the haskel library (without using external libraries). I came up with > a kind of hack that uses the grammar extension mechanism (attached). >=20 > Is there a better way of doing this ? Do I understand right: you're leveraging the camlp4 library code to build a general purpose LL(1) parser which will support runtime extension? > Does anybody have an example on how to write a simple lexer that I can > use instead ? Hmmm ... don't know about 'simple lexer' but I have a library function that can translate a representation of a labelled sequence of regexps into a tokeniser. I would not call this system 'simple' but it is entirely combinator based, and generates a lex style deterministic finite state automaton. You may want an NFA based interpreter instead though. --=20 John Skaller --=-elUbg7L4+lPX+D0Oa3a2 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBC7WExsRp8/9aGVGsRAoS1AJ9B1HwMRKdRp/yDLLjgFHq60HXXcwCfR6tA ZNyi704dyHSn0vKcF2GSDxc= =lye3 -----END PGP SIGNATURE----- --=-elUbg7L4+lPX+D0Oa3a2--