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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 75001BB81 for ; Thu, 15 Dec 2005 17:41:21 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jBFGfKDn006850 for ; Thu, 15 Dec 2005 17:41:21 +0100 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 RAA05852 for ; Thu, 15 Dec 2005 17:41:20 +0100 (MET) Received: from tomts22-srv.bellnexxia.net (tomts22.bellnexxia.net [209.226.175.184]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jBFGfI5N026213; Thu, 15 Dec 2005 17:41:19 +0100 Received: from alfajor ([65.92.242.250]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20051215164117.QWMX16473.tomts22-srv.bellnexxia.net@alfajor>; Thu, 15 Dec 2005 11:41:17 -0500 Received: by alfajor (Postfix, from userid 1000) id DE1E9D7377; Thu, 15 Dec 2005 11:41:16 -0500 (EST) Message-ID: <87y82m2ujh.fsf-monnier+inbox@gnu.org> To: Francois.Pottier@inria.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: [ANNOUNCE] Alpha release of Menhir, an LR(1) parser generator for ocaml References: <20051212175838.GA8502@yquem.inria.fr> <87acf250oi.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> <20051215084749.GD1966@yquem.inria.fr> From: Stefan Monnier Date: Thu, 15 Dec 2005 11:41:16 -0500 In-Reply-To: <20051215084749.GD1966@yquem.inria.fr> (Francois Pottier's message of "Thu, 15 Dec 2005 09:47:49 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Originating-IP: [0] X-Miltered: at nez-perce with ID 43A19CB0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43A19CAE.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 parser:01 ocaml:01 umontreal:01 tokens:01 grammar:01 parser:01 syntax:01 syntax:01 iirc:01 lexer:01 lexer:01 iirc:01 001.:98 underlying:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=X_ORIG_IP_NOT_IPV4 autolearn=disabled version=3.0.3 >> I wish it had something like ml-yacc's automatic handling of syntax-errors >> (which tries to insert/delete tokens in the input stream until the parse >> succeeds). > Do you mean instead of or in addition to the current mechanism? (I assume > instead of. I don't know if the two can be made to coexist.) I don't know enough of the details to tell you, but I'd guess it'd have to be "instead of", indeed. > I am not particularly happy with Menhir's current error mechanism, which > attempts to follow yacc's. If you could explain to us why ML-Yacc's > approach is superior, that would be great. ML-Yacc's error recovery if fully automatic: you write your grammar without worrying about error handling and the generated parser automatically signals syntax errors (note the "s" at the end: it doesn't just stop at the first syntax error) by mentioning that it had to insert a ";" at line L1 and remove an ID at line L2. For toy projects it's amazing: you get good error messages with 0 effort. The main downside of ML-Yacc IIRC has to do with the fact that it requires a fairly strong decoupling between the lexer and parser (you can't do tricks like change the lexer state from a parser semantic action IIRC), but it may be just a limitation of ML-Yacc rather than of the underlying technique. See http://www.smlnj.org/doc/ML-Yacc/mlyacc001.html#toc3 Stefan