caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Skaller <skaller@users.sourceforge.net>
To: Alex Baretta <alex@barettadeit.com>
Cc: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Limitations on $n in ocamlyacc?
Date: Fri, 27 May 2005 22:28:28 +1000	[thread overview]
Message-ID: <1117196908.7207.26.camel@localhost.localdomain> (raw)
In-Reply-To: <4296D938.30901@barettadeit.com>

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<int> 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


      parent reply	other threads:[~2005-05-27 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-27  8:24 Alex Baretta
2005-05-27  9:02 ` [Caml-list] " Alex Baretta
2005-05-27 12:28 ` John Skaller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1117196908.7207.26.camel@localhost.localdomain \
    --to=skaller@users.sourceforge.net \
    --cc=alex@barettadeit.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).