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
Another nasty with ocamlyacc: magic needed?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-05 (08:52)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Another nasty with ocamlyacc: magic needed?
On Mon, 2005-12-05 at 08:08 +0100, Alessandro Baretta wrote:
> skaller wrote:
> > I have what looks like a showstopper (meaning black magic
> > seems to be the only solution).
> > 
> > I need two *distinct* parsers which use the same set
> > of tokens. This is currently impossible AFAICS without
> > magic (distinct -- in a different module entirely)

> Let's not overstate the problem. Yacc is an imperfect tool. 

Yup :)

>  Firstly, remember that can 
> define as many parser entry points as your heat desires. 

I do. It is useful. But the secondary parser is an RD parser
interpreter. The idea isn't to allow arbitrary grammar
extensions .. only to make particular yacc productions
open-recursive closed by the dynamically built table
of extensions.

Thus the RD parser calls back into yacc entry points,
and, the yacc productions call into the RD parser entry
points. This is organised via the lexer.

> Secondly, after compiling the automaton with ocamlyacc, you can always 
> delete and regenerate the interface with ocamlc -i. 

Yes, that is possible, but the result is contains undesired
entry points (tables and whatnot). It also isn't clear
how good a solution this is if I have to paste many other
modules into it -- I can always build the whole program
as a single module :)

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