Anyweb, Document Source Code The Way You Like

➲  Date: Tue, 19 Apr 2011 21:26:42 +0200; Tags: [hack_of_the_day; anyweb; coq; ocaml].

I was playing with Adam Chlipala's “CPDT” book and I wanted to take notes on some notations. I also wanted to do it in a Literate Programming way: in a .v Coq file with a familiar and practical syntax …
That's where Anyweb comes into play.
This one-day hack is a simple parser and printer which looks for special string-markers (like (*B and B*) in Coq or OCaml sources) and does stuff (like calling coqdoc or source-highlight) depending on where it is in the source. The transformer uses an automaton and a stack, so any kind of recursive embedding seems possible.
The code is of course self-documenting (HTML, or PDF). The bunch of notes on CPDT which motivated the hack is also available (HTML, and PDF).

blog comments powered by Disqus

Sebastien Mondet


Site generated thanks to bracetax, camlmix, sebib, and more …
Updated on Sat, 10 Dec 2011 12:46:34 -0500.
Sebastien Mondet

Powered by Caml