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 BDEFBBBA7 for ; Fri, 18 Nov 2005 15:40:54 +0100 (CET) Received: from smtp15.wanadoo.fr (smtp15.wanadoo.fr [193.252.23.84]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAIEesXw029058 for ; Fri, 18 Nov 2005 15:40:54 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf1503.wanadoo.fr (SMTP Server) with ESMTP id 58C387000090 for ; Fri, 18 Nov 2005 15:40:54 +0100 (CET) Received: from wwinf1520 (wwinf1520 [172.22.146.44]) by mwinf1503.wanadoo.fr (SMTP Server) with ESMTP id 4CB4F7000089; Fri, 18 Nov 2005 15:40:54 +0100 (CET) X-ME-UUID: 20051118144054314.4CB4F7000089@mwinf1503.wanadoo.fr Message-ID: <6556771.1132324854307.JavaMail.www@wwinf1520> From: yoann padioleau Reply-To: padator@wanadoo.fr To: Sebastian Egner , skaller Subject: Re: [Caml-list] ocamlyacc -- can i tell it to be quiet? Cc: caml-list@yquem.inria.fr, caml-list-bounces@yquem.inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [193.54.76.165] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~||~| X-WUM-CC: |~||~| X-WUM-REPLYTO: |~| Date: Fri, 18 Nov 2005 15:40:54 +0100 (CET) X-Miltered: at concorde with ID 437DE7F6.000 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 regexp:01 grammar:01 const:01 extern:01 rewrite:01 btw:02 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 > > > 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 ;-). except that sometimes there is some space, comments, between the 2 "long", so the regexp for "long long" would be uselessly complicated. BTW, I dont know if your grammar talks about C, but in C you can even write "long const extern long a;"