English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[ANNOUNCE] Alpha release of Menhir, an LR(1) parser generator for ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-15 (08:46)
From: Francois Pottier <Francois.Pottier@i...>
Subject: Re: [Caml-list] [ANNOUNCE] Alpha release of Menhir, an LR(1) parser generator for ocaml
On Thu, Dec 15, 2005 at 08:04:54AM +1100, skaller wrote:

> Interestingly the 'end of stream' issue discussed at length
> in the Menhir manual then applies also to the points
> of recursion.

That's a good point. Actually, we are planning to implement in Menhir a
mechanism that helps stop at some point and invoke an external lexer or parser
(this can be any piece of code that consumes characters off the input stream).
Doing this properly requires *not* reading the lookahead token. As you point
out, the problems that arise are similar to the way the end of stream is

> It would be really nice if I could write the
> production as:
> exprx: expr ~expr
> where ~expr means 'any token which forces a reduction
> of the whole expression' if you know what I mean.

No, I don't know exactly what you mean :) I need to think more to understand
if this construction makes sense. It makes the grammar self-referential, in a
way, so it at least has to be monotonic in order to make sense.

Our plan regarding calls to external lexers or parsers was to be more rigid,
that is, to require the current statement (or expression, or whatever) to be
unambiguously terminated (for instance, by a semicolon) at the point where the
external call is made. So what you do with statements would be accepted, but
what you do with expressions might be impossible.

François Pottier