From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p04KVvMS029381 for ; Tue, 4 Jan 2011 21:31:57 +0100 X-IronPort-AV: E=Sophos;i="4.60,274,1291590000"; d="scan'208";a="85402643" Received: from yquem.inria.fr ([128.93.8.37]) by mail2-relais-roc.national.inria.fr with ESMTP; 04 Jan 2011 21:31:52 +0100 Received: by yquem.inria.fr (Postfix, from userid 18965) id 66530E1C94; Tue, 4 Jan 2011 21:31:52 +0100 (CET) Date: Tue, 4 Jan 2011 21:31:52 +0100 From: Francois Pottier To: Daniel =?iso-8859-1?Q?B=FCnzli?= Cc: caml-list@inria.fr Message-ID: <20110104203152.GA3828@yquem.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <4D23353C.8020803@gmail.com> <1259991756.440008.1294155536392.JavaMail.root@zmbs2.inria.fr> <20110104174545.GA1535@yquem.inria.fr> <1263353434.442766.1294169448342.JavaMail.root@zmbs2.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1263353434.442766.1294169448342.JavaMail.root@zmbs2.inria.fr> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [Caml-list] Array.make exception and parser On Tue, Jan 04, 2011 at 08:30:48PM +0100, Daniel Bünzli wrote: > So everybody trades developer convenience for end user convenience -- > I mean, the syntax errors produced by LR parsers are just terrible, It is true that ocamlyacc (and Menhir) offer essentially no support for explaining parse errors. (The "error" pseudo-token, inherited from yacc, is supposed to help, but in my opinion its use pollutes the grammar and makes it uncontrollable.) Nevertheless, as underlined by Yitzhak, I don't think there is a deep reason why LR parsers must be bad at explaining errors. In principle, upon detecting an error, an LR parser could easily dump the stack, which corresponds to the sentence (composed of terminal and non-terminal symbols) that has been recognized so far. It could also display the set of look-ahead tokens that would *not* have caused an error in the current state. (Come to think of it, this is a feature that I would like to add to Menhir, if only time was not so much of the essence!) -- François Pottier Francois.Pottier@inria.fr http://gallium.inria.fr/~fpottier/