From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p04HjnAl017382 for ; Tue, 4 Jan 2011 18:45:49 +0100 X-IronPort-AV: E=Sophos;i="4.60,273,1291590000"; d="scan'208";a="93817018" Received: from yquem.inria.fr ([128.93.8.37]) by mail1-relais-roc.national.inria.fr with ESMTP; 04 Jan 2011 18:45:45 +0100 Received: by yquem.inria.fr (Postfix, from userid 18965) id 2DB48E1C94; Tue, 4 Jan 2011 18:45:45 +0100 (CET) Date: Tue, 4 Jan 2011 18:45:45 +0100 From: Francois Pottier To: bluestorm Cc: Jean Krivine , =?iso-8859-1?B?VPZy9ms=?= Edwin , caml-list@inria.fr Message-ID: <20110104174545.GA1535@yquem.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <4D23353C.8020803@gmail.com> <1259991756.440008.1294155536392.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: <1259991756.440008.1294155536392.JavaMail.root@zmbs2.inria.fr> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [Caml-list] Array.make exception and parser Hello all, On Tue, Jan 04, 2011 at 04:38:56PM +0100, bluestorm wrote: > You may be interested in trying to use menhir [1] as a Parser generator > instead of ocamlyacc. Menhir is mostly compatible with ocamlyacc, but > doesn't use the Parsing module. While I don't think it as done anything > specific to support larger input files, the issue may go away (or don't > appear on the input sizes you need) using the different menhir > implementation. > > [1] http://gallium.inria.fr/~fpottier/menhir/ Interesting suggestion, indeed. Menhir does not use an ocaml array to implement the parser's stack; instead, it uses a heap-allocated linked list. It might scale up better than the ocamlyacc-generated parser (although of course it might just fill up the heap; the linked list approach probably consumes more space than the array-based approach by a constant factor). I would be curious to hear whether this works. Earlier, Daniel Bünzli wrote: > I don't really understand why people insist on using > yacc like parser generators where a recursive descent parser > with some combinators ... For what it's worth, here is my answer: an LR parser generator (like Menhir) accepts a larger class of grammars without refactoring (no need to eliminate left recursion, identify common left factors, etc.) and is also able to *explain* why the grammar is ambiguous (or rather, why it lies outside the LR class), which a combinator-based approach cannot do. -- François Pottier Francois.Pottier@inria.fr http://gallium.inria.fr/~fpottier/