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 KAA22249; Fri, 12 Sep 2003 10:24:22 +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 KAA16247 for ; Fri, 12 Sep 2003 10:24:20 +0200 (MET DST) Received: from intmail.imperium.ph ([202.175.240.154]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h8C8OIf06333 for ; Fri, 12 Sep 2003 10:24:19 +0200 (MET DST) Received: from morgoth.imperium.ph (unknown [192.168.1.35]) by intmail.imperium.ph (Postfix) with SMTP id CB03846AB8 for ; Fri, 12 Sep 2003 16:24:15 +0800 (PHT) Received: by morgoth.imperium.ph (sSMTP sendmail emulation); Fri, 12 Sep 2003 16:26:32 +0800 Date: Fri, 12 Sep 2003 16:26:32 +0800 From: "Rafael 'Dido' Sevilla" To: caml-list@inria.fr Subject: [Caml-list] eliminating shift/reduce conflicts Message-ID: <20030912082632.GA9048@imperium.ph> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Operating-System: Linux morgoth 2.4.20-gentoo-r5 User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; rafael:01 'dido':01 dido:01 foo:01 foo:01 baz:01 compiler:01 objects:02 sevilla:03 textbook:04 parse:04 ocamlyacc:05 grammar:05 hints:06 fails:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I have an ocamlyacc grammar that contains productions that look like: foo_list: FOO { [$1] } | foo_list COMMA FOO { $3 :: $1 } ; which creates a list of FOO objects. I however have some rules that need to be prefixed by either a single FOO or a foo_list, like so: bar: foo_list COLON xyzzy { ... } and baz: FOO COLON yzzyx { ... } This of course produces a shift/reduce conflict, and shifting fails to parse the 'bar' correctly. Perhaps I need to read a compiler construction textbook more thoroughly to figure out this answer, but any hints out there on getting rid of this shift/reduce. ------------------- 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