From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: by yquem.inria.fr (Postfix, from userid 18965) id A6F2BBB81; Thu, 15 Dec 2005 09:46:16 +0100 (CET) Date: Thu, 15 Dec 2005 09:46:16 +0100 From: Francois Pottier To: skaller Cc: Alessandro Baretta , Caml Mailing List Subject: Re: [Caml-list] [ANNOUNCE] Alpha release of Menhir, an LR(1) parser generator for ocaml Message-ID: <20051215084616.GC1966@yquem.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <20051212175838.GA8502@yquem.inria.fr> <1134540495.8980.63.camel@rosella> <20051214090427.GB1330@yquem.inria.fr> <439FF395.3090503@barettadeit.com> <1134594294.8942.82.camel@rosella> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1134594294.8942.82.camel@rosella> User-Agent: Mutt/1.5.9i X-Spam: no; 0.00; caml-list:01 parser:01 ocaml:01 recursion:01 lexer:01 parser:01 token:01 expr:01 expr:01 token:01 grammar:01 lexers:01 parsers:01 semicolon:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.0.3 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 handled. > 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 Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/