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 KAA06828; Mon, 24 Sep 2001 10:13:16 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA06827 for caml-list@pauillac.inria.fr; Mon, 24 Sep 2001 10:13:15 +0200 (MET DST) 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 DAA03286 for ; Mon, 24 Sep 2001 03:06:04 +0200 (MET DST) Received: from hugo.int-evry.fr (hugo.int-evry.fr [157.159.100.81]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8O164D09568 for ; Mon, 24 Sep 2001 03:06:04 +0200 (MET DST) Received: from (rinderkn@localhost) by hugo.int-evry.fr (8.8.8/jtpda-5.3) id DAA15448 ; Mon, 24 Sep 2001 03:05:55 +0200 (MET DST) Date: Mon, 24 Sep 2001 03:05:55 +0200 From: Christian RINDERKNECHT To: Vesa Karvonen Cc: caml-list@inria.fr Subject: Re: [Caml-list] On ocamlyacc and ocamllex Message-ID: <20010924030555.A15441@hugo.int-evry.fr> References: <000b01c143aa$d5218690$422aa8c0@housemarque.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <000b01c143aa$d5218690$422aa8c0@housemarque.fi>; from Vesa Karvonen on Sun, Sep 23, 2001 at 12:09:14AM +0300 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, Vesa Karvonen wrote: > Currently the generated lexer is dependent on the parser, because the > parser generates the token type. This means that each time the grammar is > modified, but not the token definitions, the lexer is recompiled. Sometimes ago, I wrote a software handling more than six lexers and parsers, and hence maintenance was complex. So I decided to enhance ocamllex with the following facilities through the command-line: (1) It can produce a functorized lexer whose argument defines the tokens. You need to use to same %token clauses as in ocamlyacc. This way different parsers can share the same lexer (the only constraint is that the %token clause in the ocamllyacc-generated parsers must be given in the same order). (2) It is possible to specify a signature to be shared among different generated lexers. (3) If you don't want a functorized lexer to be produced, you can nevertheless specify the module defining the tokens (not necessarily the ocamlyacc-generated parser). This allows you to produce from the same ocamllex specification either a functorized lexer or a non-functorized lexer. (3bis) You can even allow the functorized lexer to import a module whose signature is given by a new clause: %import. Note also that: (4) By default, the behaviour is exactly the same as for the distributed ocamllex. (5) I integrated the patch of Christian Lindig, allowing you to give arguments to your lexing rules (e.g. rule skip_line (loc) = parse ...). In think this will help you to write functionnal lexers in a readable way. (6) I documented the options in an enhanced version of the man page. (7) It is up-to-date with respect to the latest distribution of ocamllex. If you are interested, please send me an e-mail. Best regards, -- Christian ------------------------------------------------------------------------ Christian Rinderknecht Phone +82 42 866 6147 Network Architecture Laboratory Fax +82 42 866 6154 Information and Communications University WWW http://nalab.icu.ac.kr 58-4 Hwaam-dong, Yuseong-gu, Daejeon, e-mail rinderkn@icu.ac.kr 305-752, Korea ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr