From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA18570; Mon, 10 May 2004 21:19:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 VAA11145 for ; Mon, 10 May 2004 21:19:46 +0200 (MET DST) Received: from gatekeeper.elmer.external.excelhustler.com (gatekeeper.excelhustler.com [68.99.114.105]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4AJJiEV020558 for ; Mon, 10 May 2004 21:19:45 +0200 Received: from chatterbox.elmer.internal.excelhustler.com (unknown [192.168.0.12]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "chatterbox.elmer.internal.excelhustler.com", Issuer "excelhustler.com" (not verified)) by gatekeeper.elmer.external.excelhustler.com (Postfix) with ESMTP id 0889BE0220; Mon, 10 May 2004 14:19:44 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id C6F165C006; Mon, 10 May 2004 14:19:43 -0500 (CDT) Received: from wile.internal.excelhustler.com (wile.internal.excelhustler.com [192.168.1.34]) by chatterbox.elmer.internal.excelhustler.com (Postfix) with ESMTP id B35CB5C005; Mon, 10 May 2004 14:19:43 -0500 (CDT) Received: by wile.internal.excelhustler.com (Postfix, from userid 1000) id AE153F06E; Mon, 10 May 2004 14:19:43 -0500 (CDT) Date: Mon, 10 May 2004 14:19:43 -0500 From: John Goerzen To: caml-list@inria.fr Subject: [Caml-list] camlp4 extensions and lexer replacements Message-ID: <20040510191943.GB14068@excelhustler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanned-By: clamscan at chatterbox.elmer.internal.excelhustler.com X-Miltered: at nez-perce with ID 409FD5D0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; camlp:01 replacements:01 camlp:01 plexer:01 gmake:01 overwrite:01 plexer:01 lident:01 lident:01 hashtable:01 cmo:01 cmo:01 unsafe:01 imho:01 command:98 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, I am working on developing a syntax extension that: 1. Can use most of the rules in pa_o/pa_r, replaces some, and adds some 2. Requires a new lexer. Now, it's easy enough to just accomplish #1 with the EXTEND syntax. I can just place my .cmo after pa_o.cmo on the camlp4 command line and that's good. But #2 is trickier. pa_o.ml contains this: Grammar.Unsafe.gram_reinit gram (Plexer.gmake ()); So I can't define my lexer first -- pa_o.ml will just overwrite it. Worse, I can't define my lexer second, either. Plexer relies on the (strange, imho) notion of deciding whether something is a LIDENT or keyword based on the list of keywords-as-tokens that were encountered in a grammar. But the grammar reinit functions that I would have to use to put in my lexer don't preserve that information, so my lexer would have no way to differentiate a LIDENT from a keyword. Also, Plexer provides no way to get a list of entries in its internal hashtable. It seems that there should be an easy way to do this, but I just can't figure it out. I would really avoid having to hack up pa_o.ml. Thanks, John ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners