From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA21484; Fri, 13 Aug 2004 18:21:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 SAA21296 for ; Fri, 13 Aug 2004 18:21:37 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7DGLYRM016116 for ; Fri, 13 Aug 2004 18:21:34 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i7DGLRJ13356; Fri, 13 Aug 2004 11:21:27 -0500 (CDT) Date: Fri, 13 Aug 2004 11:29:18 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: David McClain cc: Ocaml Mailing List Subject: Re: [Caml-list] CFG's and OCaml In-Reply-To: <73EC7D25-ED42-11D8-99DF-000A95C19BAA@Avisere.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 411CEA8E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 mcclain:01 non-obvious:01 recursion:01 recursion:01 lalr:01 dangling:01 ocaml:01 ocaml:01 parsers:03 wrote:03 classic:03 trick:03 redirect:95 dense:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 13 Aug 2004, David McClain wrote: > Uhuhh... Yes, I did that same "evil" thing as well, even before > discussing all these reduce/reduce conflicts/ Did you get all the symbols you needed to? It looks like you need the entire first set for the "right" reduction rule. If you missed a symbol, this could still be a problem. This is why this trick is "evil". > > What I find is that these screwball little tricks might help, and the > might not. YACC is just too darned sensitive to minor and non-obvious > perturbations in the input grammar specification. Realizing its legacy, > indeed it does arise from the old IBM-360, or more properly PDP-10, > days. That was the style of programming back then.. I remember it well. The problem is that Yacc grammar is very dense. Changing the yacc description in even minor ways can have very big effects on the grammar you are actually describing. Take my example earlier of left vr.s right recursion. Consider the expression 4 * 5 / 3. With left recursion, this is parsed as (4 * 5) / 3, or 20 / 3, or 6. With right recursion, this is parsed as 4 * (5 / 3), or 4 * 1, or 4. Opps. One of the things I like about LALR(1) parsers is that my experience has been that if they get confused about something, sooner or later the user of the language will get confused about the exact same thing. Even something as "harmless" as a shift/reduce conflict. The classic example of this is the dangling else problem in C. My number one complaint with Ocaml is the number of shift/reduce (and hidden reduce/reduce) conflicts in it's grammar. These bite me on a regular basis. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners