From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DA082BCAB for ; Fri, 27 May 2005 14:28:37 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4RCSbXF002211 for ; Fri, 27 May 2005 14:28:37 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA00761 for ; Fri, 27 May 2005 14:28:36 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4RCSYND020460 for ; Fri, 27 May 2005 14:28:36 +0200 Received: from Rosella (ppp19-24.lns2.syd3.internode.on.net [59.167.19.24]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j4RCSSV3005004; Fri, 27 May 2005 21:58:29 +0930 (CST) Subject: Re: [Caml-list] Limitations on $n in ocamlyacc? From: John Skaller To: Alex Baretta Cc: Ocaml In-Reply-To: <4296D938.30901@barettadeit.com> References: <4296D938.30901@barettadeit.com> Content-Type: text/plain Date: Fri, 27 May 2005 22:28:28 +1000 Message-Id: <1117196908.7207.26.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 42971275.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42971272.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlyacc:01 baretta:01 token:01 notation:01 ocamlyacc:01 token:01 non-terminal:01 glebe:01 wrote:01 sourceforge:01 unbound:01 constructor:01 constructor:01 nsw:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Fri, 2005-05-27 at 10:24 +0200, Alex Baretta wrote: > What is the limit on the number of token values accessible with the $n > notation in ocamlyacc semantic actions? I'm asking because I'm > consistently getting ocamlyacc errors like the following, which I can't > make sense of. > > ocamlyacc: e - line 96 of "xcaml_dictionary_yacc.mly", $5 is unbound This is because the symbol has no argument: %token FRED p: FRED { $1 } will give this error, but %token JOE q: JOE { $1 } makes non-terminal q of type int, the type of JOE's argument. It is equivalent to: type token = | FRED | JOE of int then match (x:token) with | FRED ?a -> .. (* ERROR -- FRED is a constant constructor *) | JOE ?a -> .. (* OK -- JOE is a nonconstant constructor *) -- John Skaller, skaller at users.sf.net PO Box 401 Glebe, NSW 2037, Australia Ph:61-2-96600850 Download Felix here: http://felix.sf.net