Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] CFG's and OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] CFG's and OCaml
On Aug 13, 2004, at 16:04, David McClain wrote:

> simple_expr:
> 	constant
> 	...
>
> simple_pattern:
> 	signed_constant
> 	...
>
> constant:
> 	INT
> | 	FLOAT
>
> signed_constant:
> 	constant
> |	MINUS INT
> |	MINUS FLOAT
>  ;; /*  ---------------------------------------------------------- */
>
> The reduce/reduce conflict comes on deciding whether to assign an INT 
> seen to signed_constant which will reduce to simple_pattern, or 
> instead to become constant which reduces to simple_expr. Both Inria 
> and I do completely different semantic reductions in these two cases, 
> and so a reduce/reduce conflict could be fatal here...

But...  There can only be a reduce-reduce conflict if you have two 
derivations
of the same prefix, one of which expects a constant as the next 
nonterminal,
and the other expects a signed_constant.  In other words, we need more 
context
to tell what's going on.  You should give option -v to ocamlyacc and 
look
at the resulting *.output file.  It's a bit hard to understand at first,
but with some experience you can get a little information out of it.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners