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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C4748BB81 for ; Fri, 18 Nov 2005 15:39:11 +0100 (CET) Received: from pih-relay04.plus.net (pih-relay04.plus.net [212.159.14.131]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAIEdBSq028825 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 18 Nov 2005 15:39:11 +0100 Received: from [80.229.56.224] (helo=chetara) by pih-relay04.plus.net with esmtp (Exim) id 1Ed7OQ-00077z-R7 for caml-list@yquem.inria.fr; Fri, 18 Nov 2005 14:39:10 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] ocamlyacc -- can i tell it to be quiet? Date: Fri, 18 Nov 2005 14:34:22 +0000 User-Agent: KMail/1.8.2 References: <1132322923.10869.29.camel@rosella> In-Reply-To: <1132322923.10869.29.camel@rosella> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200511181434.22448.jon@ffconsultancy.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 437DE78F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlyacc:01 ctype:01 prec:01 ctype:01 prec:01 parsing:01 ocaml:01 frog:98 wrote:01 precedence:01 caml:02 objective:02 parse:02 superfluous:04 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 On Friday 18 November 2005 14:08, skaller wrote: > The following leads to shift reduce conflict: > > ctype_name: > | LONG LONG > | LONG > > Yacc is very weird -- I can parse a list of LONG without > a conflict .. but not two of them?? I'm not a yacc expert but there seem to be two possibilities: 1. The same action is repeated, in which case "LONG LONG" is superfluous and can be removed. 2. The two actions are different, in which case you need to tell yacc that LONG LONG has a higher precedence: %nonassoc LONG %prec long_long ... ctype_name: | LONG LONG %prec long_long { ... } | LONG { ... }; I think this is equivalent to the dangling "else" problem. Anyway, you shouldn't be parsing C++, it is bad for your health. ;-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists