From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 0EBCABC0A for ; Sat, 17 Mar 2007 18:12:58 +0100 (CET) Received: from blizzard.cs.caltech.edu (blizzard.cs.caltech.edu [131.215.44.2]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2HHCuDq003265 for ; Sat, 17 Mar 2007 18:12:57 +0100 Received: from localhost (flood.cs.caltech.edu [131.215.44.31]) by blizzard.cs.caltech.edu (Postfix) with ESMTP id A14C82A2F61; Sat, 17 Mar 2007 10:12:55 -0700 (PDT) Received: from snowstorm.cs.caltech.edu ([131.215.44.21]) by localhost (flood.cs.caltech.edu [131.215.44.31]) (amavisd-new, port 10024) with ESMTP id 08924-04; Sat, 17 Mar 2007 10:12:55 -0700 (PDT) Received: from [192.168.3.10] (cpe-75-82-142-242.socal.res.rr.com [75.82.142.242]) by snowstorm.cs.caltech.edu (Postfix) with ESMTP id 63160262FD9; Sat, 17 Mar 2007 10:11:01 -0800 (PST) Message-ID: <45FC2196.8060704@metaprl.org> Date: Sat, 17 Mar 2007 10:12:54 -0700 From: Aleksey Nogin Reply-To: caml-list@inria.fr Organization: MetaPRL/Mojave Research Group User-Agent: Thunderbird 1.5.0.10 (X11/20070304) MIME-Version: 1.0 To: Christophe Raffalli Cc: caml-list@inria.fr Subject: Re: [Caml-list] ocamlyacc, menhir, dypgen, camp4, elkhound References: <45FB033A.5040201@univ-savoie.fr> In-Reply-To: <45FB033A.5040201@univ-savoie.fr> X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45FC2198.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocamlyacc:01 christophe:01 camlp:01 camlp:01 parametrized:01 grammars:01 parametrized:01 ocaml:01 grammars:01 debugging:01 parsing:01 afaik:01 undef:01 tokens:01 functor:01 Christophe, I am not an expert in camlp4, but I probably know enough to be able to fill in a few blanks in the last column of your table. My answers are based on "old" 3.09 camlp4 and might be different for the new 3.10 one. Handled grammar: LL(1) Reentrant: Yes, but with caveats(*1) Extensible (an action can change the grammar): Yes(*2) Parametrized non terminal: No (???, *3) Splitting the definition of a non terminal: Yes Grammars parametrized by Ocaml modules: ??? (Yes? - *4) Partial action: No Ambiguous grammars: Yes (???, *5) Exception to reject a rule: No (???) Priority: Using levels (= a partial order as a relation) + associativity direction Debugging grammars: hard --- (*1) In 3.09, reentrant parsing works, except the error messages might end up pointing to the wrong place in the source stream (supposed to be fixed in 3.10, AFAIK). However, there is no good way of passing a state to the grammar actions. As a result, one often has to resort to using a global ref to hold the state, which, obviously, kills the ability to be reentrant. (*2) For example, see the pa_macro where the action for the DEFINE and UNDEF expressions change the grammar accordingly. (*3) As far as I understand, only tokens can be parameterized, although that might have changed in 3.10. (*4) I am not sure which capability exactly is meant here. In Camlp4, the grammar definitions/extensions can be done inside a body of a functor. The actual grammar is created when the functor is applied. (*5) Not sure what is meant here. In camlp4, unfortunately, there is no way to test the grammar for ambiguities - it accepts an ambiguous grammar without any warnings. Aleksey On 16.03.2007 13:51, Christophe Raffalli wrote: > > Hi, > > The programs listed in the subject of this mail are parser generators > for OCaml ... > There may be others, and there is also the possibility to write parsers > by hand using stream pattern matching, parser combinators, etc ... > (the later technics are not covered here) > > It would be nice to have a small comparison table to help people making > a decision ? Being not neutral > (dypgen was developped by a student at ENS lyon under my direction) I > think I should not do it myself ... > > But I gave it a try. Here is a first draft (This table is not correct > yet and should not be used to make a decision ;-) > > http://www.lama.univ-savoie.fr/~raffalli/ocaml-parsing.html > > The html produced by ooffice is poor and the calculator example is not > well presented due to an ooffice bug (I think). > > Questions > > - Can you help me complete the table (missing lines, columns, > inaccurate or missing information) ? > - Can you provide the best possible calculator example for the other > parser as a text file ? > - Can you provide a really difficult but short grammar to make a better > comparison ? > - Other Idea welcome > - If someone neutral wants to volonteer to host this comparison table, I > will be very please to send him the source of the table. > > Christophe Raffalli > > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >