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 KAA31819; Fri, 10 Aug 2001 10:40:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA31730 for ; Fri, 10 Aug 2001 10:40:51 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f7A8ekj16429; Fri, 10 Aug 2001 10:40:46 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id KAA28176; Fri, 10 Aug 2001 10:40:46 +0200 Date: Fri, 10 Aug 2001 10:40:46 +0200 From: Daniel de Rauglaudre To: Ceri Storey Cc: caml-list@inria.fr Subject: Re: [Caml-list] Possible bug in the lexer? Message-ID: <20010810104046.B28052@verdot.inria.fr> References: <20010810055128.E83936@mandelbrot.house.pkl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0us In-Reply-To: <20010810055128.E83936@mandelbrot.house.pkl.net>; from cez@pkl.net on Fri, Aug 10, 2001 at 05:51:28AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, On Fri, Aug 10, 2001 at 05:51:28AM +0100, Ceri Storey wrote: > I think I've discovered wierd bug in ocaml's lexer. it seems that in > ocaml 3.01, and 3.02, (and camlp4 original syntax) the following will not > parse: > parser [< ' '"' >] -> ();; While reading the input, the lexer, instead of reading the token "quote" and the token "character double-quote", reads the token "character space" and then the double quote... It is a design bug, actually. In streams and parsers, the quote is a token used to introduce a "terminal". In Caml Light (before OCaml), there was no confusion because the token "character" was enclosed by backquotes. Since OCaml, the characters have been enclosed by right quotes (what is more usual). At that time, we should have changed the token introducing "terminals" in streams and parsers, we could have choosen backquotes, for example. But we forgot. It is the reason of this problem. This is fixed in revised syntax of Camlp4. In normal syntax, if you have to specify a "terminal" in a parser, you must be sure that there is no simple quote 2 characters after your simple quote. Write your example as: parser [< ''"' >] -> ();; or parser [< ' '"' >] -> ();; And write: parser [< ' ('"' | 'a') >] -> ();; not: parser [< '('"' | 'a') >] -> ();; Sorry for the inconvenience... due to historical reasons, what is often the case... -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- 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