caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Limitations on $n in ocamlyacc?
@ 2005-05-27  8:24 Alex Baretta
  2005-05-27  9:02 ` [Caml-list] " Alex Baretta
  2005-05-27 12:28 ` John Skaller
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Baretta @ 2005-05-27  8:24 UTC (permalink / raw)
  To: Ocaml

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


Alex

-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Limitations on $n in ocamlyacc?
  2005-05-27  8:24 Limitations on $n in ocamlyacc? Alex Baretta
@ 2005-05-27  9:02 ` Alex Baretta
  2005-05-27 12:28 ` John Skaller
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Baretta @ 2005-05-27  9:02 UTC (permalink / raw)
  To: ocaml

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

The obvious answer is...
... PEBKAC!

The was one unterminated semantic actions tens of lines above the spot
where the ocamlyacc was unable to proceed. Casually, the syntax
production contained 4 symbols; hence, the unbound $5...

Alex



-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Limitations on $n in ocamlyacc?
  2005-05-27  8:24 Limitations on $n in ocamlyacc? Alex Baretta
  2005-05-27  9:02 ` [Caml-list] " Alex Baretta
@ 2005-05-27 12:28 ` John Skaller
  1 sibling, 0 replies; 3+ messages in thread
From: John Skaller @ 2005-05-27 12:28 UTC (permalink / raw)
  To: Alex Baretta; +Cc: Ocaml

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-05-27 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27  8:24 Limitations on $n in ocamlyacc? Alex Baretta
2005-05-27  9:02 ` [Caml-list] " Alex Baretta
2005-05-27 12:28 ` John Skaller

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).