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
Custom lexer in Camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-06-24 (14:39)
From: Jeremy Yallop <jeremy.yallop@e...>
Subject: Re: [Caml-list] Custom lexer in Camlp4
Nicolas Pouillard wrote:
> Excerpts from Jeremy Yallop's message of Tue Jun 24 15:03:19 +0200 2008:
>> Is there a way to replace the default lexer in Camlp4?  I'd like to use 
>> (an extended version of) one of the OCaml grammars, but with a different 
>> lexer.
> You can rebuild (I mean functor application), your own camlp4 by giving
> another Lexer module. Basically you will have to copy/paste the short
> Camlp4.PreCast module (or a part of), by substituting Camlp4.Struct.Lexer
> by your Lexer implementation. That's fairly heavy but works.

Ok, I've built a slightly modified clone of PreCast.  What's the best 
way to persuade Camlp4 to use it?  The original PreCast seems fairly 
hardwired, e.g. in the Register module.

Thanks for your help.


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.