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 7598FBB81; Fri, 18 Nov 2005 15:17:53 +0100 (CET) Received: from gw-eur4.philips.com (gw-eur4.philips.com [161.85.125.10]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAIEHq8K024495; Fri, 18 Nov 2005 15:17:53 +0100 Received: from smtpscan-eur4.philips.com (smtpscan-eur4.mail.philips.com [130.144.57.167]) by gw-eur4.philips.com (Postfix) with ESMTP id 9DF3149725; Fri, 18 Nov 2005 14:17:52 +0000 (UTC) Received: from smtpscan-eur4.philips.com (localhost [127.0.0.1]) by localhost.philips.com (Postfix) with ESMTP id 663AA684C; Fri, 18 Nov 2005 14:17:52 +0000 (GMT) Received: from smtprelay-eur2.philips.com (smtprelay-eur2.philips.com [130.144.57.171]) by smtpscan-eur4.philips.com (Postfix) with ESMTP id 40493684B; Fri, 18 Nov 2005 14:17:52 +0000 (GMT) Received: from ehvrmh02.diamond.philips.com (ehvrmh02-srv.diamond.philips.com [130.139.27.125]) by smtprelay-eur2.philips.com (Postfix) with ESMTP id 0A6483F; Fri, 18 Nov 2005 14:17:52 +0000 (GMT) In-Reply-To: <1132322923.10869.29.camel@rosella> To: skaller Cc: caml-list@yquem.inria.fr, caml-list-bounces@yquem.inria.fr Subject: Re: [Caml-list] ocamlyacc -- can i tell it to be quiet? MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.0.3 September 26, 2003 Message-ID: From: Sebastian Egner Date: Fri, 18 Nov 2005 15:16:04 +0100 X-MIMETrack: Serialize by Router on ehvrmh02/H/SERVER/PHILIPS(Release 6.5.3FP1HF291 | September 19, 2005) at 18/11/2005 15:16:08, Serialize complete at 18/11/2005 15:16:08 Content-Type: multipart/alternative; boundary="=_alternative 004E88BAC12570BD_=" X-Miltered: at concorde with ID 437DE290.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlyacc:01 ctype:01 lalr:01 parser:01 lexer:01 tokens:01 lexer:01 ocamllex:01 ctype:01 lalr:01 parser:01 tokens:01 ocamllex:01 rewrite:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_40_50,HTML_MESSAGE autolearn=disabled version=3.0.3 This is a multipart message in MIME format. --=_alternative 004E88BAC12570BD_= Content-Type: text/plain; charset="US-ASCII" > 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?? > > Is there any way to tell it to shut up? Rather than trying to solve this in the LALR parser (which might involve a major rewrite of the grammer in this case), the easiest way is to adapt the _lexer_ to produce two different tokens for "long" and for "long long": The lexer (ocamllex) always goes for the longest match, and in this case this is what you want ;-). Sebastian. --=_alternative 004E88BAC12570BD_= Content-Type: text/html; charset="US-ASCII"
> 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??
>
> Is there any way to tell it to shut up?

Rather than trying to solve this in the LALR parser (which
might involve a major rewrite of the grammer in this case),
the easiest way is to adapt the _lexer_ to produce two
different tokens for "long" and for "long long": The lexer
(ocamllex) always goes for the longest match, and in this
case this is what you want ;-).

Sebastian. --=_alternative 004E88BAC12570BD_=--