Version française
Home     About     Download     Resources     Contact us    
Browse thread
OCamlduce + camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain@f...>
Subject: Re: [Caml-list] OCamlduce + camlp4
Arnaud Spiwack wrote:
> There I discovered that I couldn't find a camlp4 syntax file for 
> OCamlduce (to be able to extend OCamlduce's syntax). In my case, I'd 
> like an equivalent to camlp4orf (original syntax, but revised-syntax 
> quotations) that handles OCamlduce syntax (though, original-syntax 
> quotation would require little to change, thus would be all right).
> 
> Does anybody know whether it already exists ? (maybe Alain or Nicolas ;) ).
> 
> If it does not, I shall consider making one myself, but I will have to 
> know better of the insides of OCamlduce.

I'm not aware of a Camlp4 parser for OCamlduce (which probably means 
that such a thing does not exist). It should not be difficult (only 
quite boring) to write one. Of course, before writing the grammar, 
you'll have to extend Camlp4's OCaml syntax tree with new constructions 
and its translation to the real OCaml AST (Parsetree).

The OCamlDuce parser uses different lexers for the OCaml and CDuce 
parts. This is done by switching lexing mode on a few tokens ( {{, {:, 
:}, }}). It is possible to reproduce that with Camlp4 (you can plug an 
arbitrary lexer).

Let me know if you need more assistance on the OCamlDuce side...

Good luck!


-- Alain