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-02 (18:35)
From: Francois Pottier <Francois.Pottier@i...>
Subject: Re: [Caml-list] menhir

On Thu, May 03, 2007 at 02:29:17AM +1000, skaller wrote:
> Built an LR(0) automaton with 1416 states.
> Built an LR(1) automaton with 2009 states.
> Warning: 145 states have an end-of-stream conflict.
> Can I send you the file?

Sure, please do (perhaps off the list).

> Yes, but you cannot write functions that take a state argument
> because lexbuf is a fixed data type and there's no where to
> add in any user state data.

But my point is that you never need to pass a state argument to a parser
function. Instead, you can just have the function capture the address of the
(mutable) state in its closure.

> EOF is returned an infinite number of times in C.

Point taken.

> This requires the definition: parse the *shortest* head of the
> input stream.

In fact, if there are no end-of-stream conflicts, then the head of the input
stream is *unique*, so you don't need to specify whether you are interested in
a shortest or longest prefix.

> > ocamlyacc never complains. It just trusts you to know what you are doing.
> I generate an .output file, grep for the word 'conflict',
> and terminate my build if there is one found. I do not permit
> any conflicts in my grammar: it's strictly unambiguous LALR(1).

Sure, but ocamlyacc does not report end-of-stream conflicts, which I believe
are real issues...

> It's also pure in the sense that it doesn't use crud 
> like %left, %prec etc to resolve conflicts.

Good, good!

> [The way dypgen does this is vastly superior!]

How does it work?

François Pottier