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 E6E2DBB81 for ; Fri, 23 Sep 2005 17:30:57 +0200 (CEST) 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 j8NFUv3T020462 for ; Fri, 23 Sep 2005 17:30:57 +0200 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 RAA18462 for ; Fri, 23 Sep 2005 17:30:56 +0200 (MET DST) Received: from vaxjo.synopsys.com (vaxjo.synopsys.com [198.182.60.75]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8NFUtSY020456 for ; Fri, 23 Sep 2005 17:30:56 +0200 Received: from crone.synopsys.com (crone.synopsys.com [146.225.7.23]) by vaxjo.synopsys.com (Postfix) with ESMTP id 7A324DBB3 for ; Fri, 23 Sep 2005 08:30:51 -0700 (PDT) Received: from US01WEBRH1.internal.synopsys.com (localhost [127.0.0.1]) by crone.synopsys.com (8.9.1/8.9.1) with ESMTP id IAA24151 for ; Fri, 23 Sep 2005 08:30:51 -0700 (PDT) Received: from US01Natrium.internal.synopsys.com ([10.9.67.42]) by US01WEBRH1.internal.synopsys.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 23 Sep 2005 08:30:51 -0700 Received: from ca05osmium.internal.synopsys.com ([10.44.8.226]) by US01Natrium.internal.synopsys.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 23 Sep 2005 08:30:50 -0700 Received: from synopsys.com ([10.44.9.157]) by ca05osmium.internal.synopsys.com with Microsoft SMTPSVC(5.0.2195.5329); Fri, 23 Sep 2005 11:30:49 -0400 Message-ID: <43341FA9.90704@synopsys.com> Date: Fri, 23 Sep 2005 11:30:49 -0400 From: Alan Falloon User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ocaml Subject: Re: [Caml-list] Yacc limitations References: <43327FEF.7070209@barettadeit.com> In-Reply-To: <43327FEF.7070209@barettadeit.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 23 Sep 2005 15:30:49.0268 (UTC) FILETIME=[C65C3F40:01C5C053] X-Miltered: at nez-perce with ID 43341FB1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43341FAF.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 baretta:01 parser:01 ocamlyacc:01 parser:01 ocaml:01 lalr:01 syntax:01 grammar:01 ocamlyacc:01 lalr:01 token:01 grammar:01 verbose:01 ocaml:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Alex Baretta wrote: >I am getting very much annoyed with the obtusity of the LALR-yacc parser >generators. I have unsurmountable difficulties at teaching ocamlyacc how >to parse SQL decently. > >What is the "way to go" in terms of parser generators for Ocaml? I'd >like to see if there is some level of agreement in the community on this >issue. > > I am not very familiar with SQL, so I may be missing something important, but a quick google search for 'sql grammar' turned up what appears to be an LALR grammer already in *yacc syntax at http://docs.openlinksw.com/virtuoso/GRAMMAR.html I have also been frustrated in the past with yacc, bison, and ocamlyacc, but its usually not the LALR restriction as much as the lack of decent short-hand for common operations like a list of elements (with or without a separator token) which make the grammar a lot more verbose than it should really need to be. Also, with the C parser generators, it was always a huge pain to represent the parse tree in any reasonable way, but with ocaml and ocamlyacc that is a non-issue. I do agree that debugging conflicts seems to be harder than it should be. It would be wonderful if that could be addressed. As far as the LALR restriction goes, bison has an optional GLR parser (see http://www.delorie.com/gnu/docs/bison/bison_90.html) that seems like it could be added to ocamlyacc with a pretty straightforward translation if anyone had the time and motivation to do it. -- Alan Falloon