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
Hacking the lexer in the new camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-28 (22:22)
From: Harrison, John R <john.r.harrison@i...>
Subject: Hacking the lexer in the new camlp4
I haven't really been following the discussion about the new camlp4,

but it seems quite a lot has changed.


I only use some fairly simple extensions to parsing (a few new infix

names, and forcing anonymous expressions "..." to become "let it =

..."). However I also make two invasive changes to the lexer:


 * Modify the lexical rules for deciding whether a name is a regular

   or special identifier (not just based on case of the first letter)


 * Change the quotation delimiters to be `...` rather than <<...>>


In the current camlp4, the only way I found to do this was basically

to copy the existing lexer and edit it. Although it works, it's ugly

and invariably means that I've had to change something with almost

every new version of camlp4. Does the new camlp4 offer a nicer way of

changing the lexer?