Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-01 (17:11)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] menhir
On Tue, 2007-05-01 at 17:57 +0200, Francois Pottier wrote:

> > So the conflicts are spurious: end of stream can't be parsed
> > (but of course Menhir doesn't know that). This is good,
> > because Mehir CANNOT detect end of stream, since my lexbuf
> > is a dummy and is not used at all.
> Perhaps the terminology "end-of-stream conflict" is badly chosen. These
> conflicts are not just about detecting the end of the stream: they are about
> recognizing a non-terminal symbol without overshooting, that is, without
> unnecessarily requesting a lookahead token (a request which, if the end of
> stream has been reached, could be unsatisfiable, or could be blocking).
> These conflicts are not "spurious": just like shift/reduce or reduce/reduce
> conflicts, they will cause trouble.

They're not technically spurious, but for my grammar they're
spurious because the input language isn't arbitrary, it
always has an ENDMARKER at the end of the token stream,
and the parser never processes any symbols past that.

It can't hit 'end of stream' because that's a state
of the lexbuf .. and the lexbuf is is a dummy which is
never updated or modifed -- so it can't ever be in
the end-of-stream state.

So basically, menhir is saying "what happens if you hit
end of stream here? What should be done?" and the answer
is "it can't happen".

BTW: Ocamlyacc doesn't report any conflicts, so this
is a minor incompatibility.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: