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 stream parser syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: Re: Re : [Caml-list] Re: camlp4 stream parser syntax

On Mar 8, 2009, at 2:09 PM, Matthieu Wipliez wrote:

> using a single rule, say
>  buy : [ [ "buyOrSell"; ... ] ]

Yes, I want camel-case above.

> and at lexing time do
>  if String.lowercase s = "buyorsell" then
>    IDENT "buy_or_sell"
>  else
>    IDENT s

And this is the part that I object to. I have quite a number of  
keywords and I don't want to have a bunch of if statements or have a  
hash table mapping lowercase to camel case. This would mean having to  
track the parser (camel case) version in two places: the lexer and the  

What I want is to extend Camlp4.Struct.Grammar.Static with a custom  
version of Make that applies String.lowercase before giving the string  
to 'using' to be inserted into the keywords table.

	Thanks, Joel

Mac, C++, OCaml