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: 2009-03-08 (10:35)
From: Joel Reymont <joelr1@g...>
Subject: Re: Re : [Caml-list] Re: camlp4 stream parser syntax

On Mar 8, 2009, at 10:27 AM, Daniel de Rauglaudre wrote:

> Only changing the "tok_match" record field (2nd point) would not work
> for keywords (defined by "just a string" in Camlp* grammars), because
> the lexer *must* recognize all combinations of the identifier as
> keywords, implying a change, anyway, in the lexer.

This is precisely what I'm trying to figure out.

What do I have to change in my _custom_ lexer generated by ocamllex to  
recognize keywords defined by just a string in camlp4 grammars. I'm  
not using LIDENT, etc. as I have my own set of tokens.

I understand that I need to downcase the keyword (or upcase) but I  
don't understand where I need to do this.

The filter module nested in the token module seems like a good  
candidate. What functions of the lexer or filter are accessed when a  
string keyword (e.g. "delay") is found in the camlp4 grammar?

	Thanks, Joel

Mac, C++, OCaml