From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1BA3HMB002842 for ; Fri, 11 Feb 2011 11:03:18 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0BADKYVE3RVaE2dGdsb2JhbAClbQgVAQwJDAcNAgYgogaMJoRiiQkBAQMFhVcEi3yIOzqBEA X-IronPort-AV: E=Sophos;i="4.60,454,1291590000"; d="scan'208";a="87852233" Received: from mail-fx0-f54.google.com ([209.85.161.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Feb 2011 11:03:12 +0100 Received: by fxm16 with SMTP id 16so2739089fxm.27 for ; Fri, 11 Feb 2011 02:03:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:content-type; bh=6TZbCeguEItwDf2uySrrjOIYhOPRAOEPC5QSCcuUzWQ=; b=sA5RdOUhWRAM2yKQu5lXE74I5Gn1TbLpolLx85bp8GQL+OqO9R56Y+cS27RZIoI1zW 3/giOyciGaMdHdXYKSOMoQhnpD/B78nItPoM4gshCwTZ6bZCpFiasNPChE1ny0IH7cFg z122gNJGoPEt37WEmOrouAupBPJ9qXqWJrCi8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=e5btn1bwAGDYy13PfBbHub3X80+HbJ6p2vkfjO3ZRigXzG14UIBA7dElm+loZ8vN5C atx9bbehOyIbyDZI2ohcBF4WGcXbr03K/hK7FBoYaRyXfeOYzJzCh/iqxIztczWRiw+N We/+GBm2IgGhmFkDgoxvUDBwMGq60iRRFgVgw= Received: by 10.223.72.14 with SMTP id k14mr288305faj.45.1297418529231; Fri, 11 Feb 2011 02:02:09 -0800 (PST) MIME-Version: 1.0 Sender: david.mentre@gmail.com Received: by 10.223.158.70 with HTTP; Fri, 11 Feb 2011 01:59:56 -0800 (PST) In-Reply-To: References: From: David MENTRE Date: Fri, 11 Feb 2011 10:59:56 +0100 X-Google-Sender-Auth: r6_NUjuVpah2mY0cx-4bnVSXAEk Message-ID: To: caml users Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] Re: Priority issue in an ocamlyacc grammar Hello, 2011/2/11 David MENTRE : > Then, I define in my grammar a rule to parse an expression (exp): > """ > exp: LPAREN exp RPAREN { $2 } > | INT MAPLET IDENTIFIER %prec MAPLET { Enum_value($1, $3) } > | NOT LPAREN exp RPAREN { Not($3) } > | exp SPACES EQUAL SPACES exp %prec EQUAL { Equal($1, $5) } > | exp SPACES AND SPACES exp %prec AND { And($1, $5) } > | exp SPACES OR SPACES exp %prec OR { Or($1, $5) } > | exp SPACES IMPLY SPACES exp %prec IMPLY { Imply($1, $5) } > | exp SPACES EQUALEQUAL SPACES exp { Equalequal($1, $5) } ... > """ ... > It appears that the OR operator binds more tightly than the EQUAL operator! I've found it: the SPACES token did not allow to chose the correct rule while parsing. Removing it brings a correct parsed tree. Regards, david