[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Limitations on $n in ocamlyacc? |
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