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
[Camlp4] Beta-release
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-05-22 (22:39)
From: Aleksey Nogin <nogin@c...>
Subject: Re: [Caml-list] [Camlp4] Beta-release
On 17.05.2006 00:52, Nicolas Pouillard wrote:

>> Basically, I would really like to see camlp4 help with the following:
>> 1) Defining parsers that depend on a shared state that is passed around.
> I don't know what you mean by shared state: a mutable data, a purely
> functional data structure?

It should probably up to the end-users. The idea then would be to have 
the parser thread (in fold-style) the state through the productions and 
it would be up to the individual productions to decide whether to modify 
it in place or to return a different value functionally.

> And what will be the kind of this state,
> because that state must be extensible by any extension.

The grammar type should probably be polymorphic in the type of the state.

BTW, in some of our code Jason Hickey have implemented an extensible LR1 
parser generator with such a polymorphic "fold-style" state handling 
(where the state is threaded both through the lexer and through all the 
productions). See the lm_parser and lm_lexer modules at 
http://svn.metaprl.org/viewcvs/mojave/libmojave/util/ (can also be 
checked out via Subversion from svn://svn.metaprl.org/libmojave/util/ ).

>> 3) (completely unrelated) I wish there was a way to tell camlp4 to
>> detect and report conflicts!
> There is no way to detect more conflicts than by default. Sorry.

Would it be possible to add such detection? Possibly in the form of a 
camlp4 module that processes the grammar extension directives 
differently, retaining more information as needed for such analysis?

Aleksey Nogin

Home Page: http://nogin.org/
E-Mail: nogin@cs.caltech.edu (office), aleksey@nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200