http://code.google.com/p/ocaml-burg/
http://brion.inria.fr/gallium/index.php/OCaml_code_generatio...
http://flint.cs.yale.edu/cs421/case-for-ml.html
http://www.reddit.com/r/programming/comments/bbnao/falling_o...
http://en.wikipedia.org/wiki/Camlp4
(F# has a rich set of parsing/generating tools also: fslex, fsYacc, fparsec and active patterns, also.)
http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf
http://caml.inria.fr/pub/docs/oreilly-book/
And yes, OCaml is excellent for that sort of thing. Pattern matching in particular is a HUGE advantage.