Re: Can someone explain?

From: Gerd Stolpmann (
Date: Tue Oct 05 1999 - 21:35:34 MET DST

From: Gerd Stolpmann <>
To: skaller <>
Subject: Re: Can someone explain?
Date: Tue, 5 Oct 1999 21:35:34 +0200
Message-Id: <99100521343800.17263@ice>

On Tue, 05 Oct 1999, John Skaller wrote:

> The other thing I would beg for is to fix the parser
>and lexer to be re-entrant [purely functional]. At present, state
>must be kept in global store :-(
> It would also be useful if the parser could support nested
>parser calls as the lexer can: this is possible with the lexer,
>because the lexbuf is always in a state to read the next lexeme,
>however it is not possible with the parser because it may have read
>a token ahead of the production being reduced.

I have recently posted a solution for this problem by turning the
generated parser into a class; side-effects still exist but are
limited to the object representing the parser. You can simply create
several instances of the same parser, and nested parser calls are possible
if the sub-parser resides in a different object than the calling parser.

The solution requires a complicated Makefile, and I again suggest to
support an object-oriented parser generator in one of the next caml
releases. You find a description of the idea here:

A working application is my XML parser, look at the files markup_yacc.mly and
Makefile.code in
As any real application, this parser is much more complicated than necessary to
demonstrate the principle...


Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail: (privat)

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:26 MET