[LLVMdev] LLVM OCaml Tutorial

Jon Harrop jon at ffconsultancy.com
Wed Apr 22 10:16:07 PDT 2009

On Wednesday 22 April 2009 12:15:09 Chris Wailes wrote:
> That is perfectly understandable.  My problem was that I had never seen the
> stream syntax before.  While I'm no OCaml master, I have used it for a
> while and so it might be that other people coming to the tutorial may have
> the same experience.

This page may be of help:


It describes recursive descent parsing using the camlp4 stream parser 
extension and lex/yacc.

You may also be interested in this LLVM-based example in OCaml that uses 
camlp4 for parsing directly:


> Secondly, it seems odd to be writing custom parsers 
> and lexers after tools like Bison and Flex (and ocamllex and ocamlyacc)
> have been around for some time.  Is there any particular reason the C++
> tutorial is using  hand coded parsers and lexers?  Is there a technical
> reason?

I found flex and bison really tedious to use from C++. That was a long time 
ago and there are probably better alternatives now though. Still much worse 
than anything with first-class lexical closures and algebraic datatypes, of 
course. :-)

Dr Jon Harrop, Flying Frog Consultancy Ltd.

More information about the llvm-dev mailing list