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 (00:07)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] camlp4 stream parser syntax
On Saturday 07 March 2009 23:53:03 you wrote:
> Should I be using camlp4 grammars as Matthieu suggested?
> It seems there are are far more and better resources on doing this
> than the stream parsing approach. This includes your OCaml Journal.

I would say that there is very little documentation about either approach but 
I personally found it much easier to use the stream parsers rather than 
camlp4 because they are much simpler and, therefore, do not require so much 
documentation. Having said that, I never used ??.

> Do I loose anything when going with camlp4 grammars and NOT parsing
> into an OCaml AST?

No, parsing into other ASTs is really easy with Camlp4.

> Do I gain a lot with grammars over stream parsing? 

Swings and roundabouts, IMHO. Camlp4 is higher level, more capable and the 
syntax is clearer but the documentation is so poor that I have given up every 
time I have tried to use it either because the default lexer was insufficient 
or because I could not figure out how to extract the necessary data from the 
OCaml grammar.

Matthieu's example looks fantastic though...

Dr Jon Harrop, Flying Frog Consultancy Ltd.