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=1.2 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 83457BC69 for ; Tue, 24 Oct 2006 23:40:47 +0200 (CEST) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.196]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9OLeie7006379 for ; Tue, 24 Oct 2006 23:40:45 +0200 Received: by nz-out-0102.google.com with SMTP id x3so792602nzd for ; Tue, 24 Oct 2006 14:40:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Lw5wHHQxqm9TeW1hg2LeCLx5DcWE676YR5WZKBdtWmPUzrp6F2Eba5BSyWzew2fZM521mfAGcuPZFY9vSryMWpbB4L0T/PHDp+30p0e5hxvYmfiEmJLuU2qaNkVZiG2t4DuFmN33HFu/7J5hnnBeWGRMm23eUie4D/5LcCAMzWs= Received: by 10.35.8.13 with SMTP id l13mr9673130pyi; Tue, 24 Oct 2006 14:40:43 -0700 (PDT) Received: by 10.35.10.18 with HTTP; Tue, 24 Oct 2006 14:40:43 -0700 (PDT) Message-ID: <1af89fca0610241440j202e9c43m3025d2395b456f34@mail.gmail.com> Date: Tue, 24 Oct 2006 23:40:43 +0200 From: "=?ISO-8859-1?Q?Yann_R=E9gis-Gianas?=" Reply-To: yann@regis-gianas.com To: "David Allsopp" Subject: Re: [Caml-list] Fairly dumb ocamlyacc question Cc: "OCaml List" In-Reply-To: <003401c6f7b0$01f9ca10$5a878640@countertenor> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <003401c6f7b0$01f9ca10$5a878640@countertenor> X-j-chkmail-Score: MSGID : 453E885C.000 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 453E885C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; regis-gianas:01 ocamlyacc:01 ocamlyacc:01 kwd:01 kwd:01 parser:01 prec:01 parser:01 beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 token:01 token:01 Hello, Have you tried menhir : http://pauillac.inria.fr/~fpottier/menhir/menhir.html.en ? Menhir generates an explanation of your conflicts and is 90% compatible with ocamlyacc. Hope this helps, -- Yann R.-G. On 10/24/06, David Allsopp wrote: > This should be obvious, but I can't quite solve it! > > If I use the following ocamlyacc script: > > ------------ > %token BEFORE_KWD AFTER_KWD > %token FAILS_KWD > > %token WEEKDAY > %token NAME > > %type top > %start top > %% > > top: > WEEKDAY AFTER_KWD NAME BEFORE_KWD NAME FAILS_KWD top {()} > | WEEKDAY relative NAME {()} > ; > > relative: > BEFORE_KWD {()} > | AFTER_KWD {()} > ; > ------------ > > Then I get a shift/reduce having parsed WEEKDAY AFTER_KWD... the parser > can't figure out what to do if it sees NAME. This problem can be made to > disappear by expanding the relative rules to give: > > top: > WEEKDAY AFTER_KWD NAME BEFORE_KWD NAME FAILS_KWD top {()} > | WEEKDAY AFTER_KWD NAME {()} > | WEEKDAY BEFORE_KWD NAME {()} > ; > > I've tried a couple of tricks with %prec but can't get the parser to come > out the same way with the first rule... please could someone put me out of > my misery!! > > Thanks, > > > David > > _______________________________________________ > 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 > -- Yann