Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
camlp4 - can you customize the lexer?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] camlp4 - can you customize the lexer?
Excerpts from Richard Jones's message of Fri May 09 11:40:36 +0200 2008:
> The Camlp4 wiki contains an intriguing line "Connecting your own
> Lexer.", but no link or information.  I want to modify the OCaml lexer
> to add a syntax for integer literals of my own type.  Can this be
> done?  How?

Since  Camlp4,  is  now  a  lot  more  modular.  This can be done by providing
*another*  Lexer  module  with  a  compatible signature. Then one create a new
Camlp4.PreCast module by copy/pasting and using the new Lexer module.
However the default lexer of Camlp4 is not extensible.

Best regards,

Nicolas Pouillard aka Ertai