A Definitional Transpiler For BLOG
A Definitional Transpiler For BLOG was my third-year project at Oxford. The idea was to translate statistical models written in a Probabilistic Programming Language into a Haskell monad.
The PPL in question was Stuart Russel's BLOG, developed at UC Berkeley. Here's an example of a simple BLOG program:
My translator lexes (tokenizes) a program like this with Alex, parses the token stream with Happy, and translates the resulting syntax tree into something like this:
The Prob monad (which encodes uncertain values) is the central feature of LazyPPL, a lazy probability library being developed at the University of Oxford's Department of Computer Science.
The translator can be found at its GitHub repository. Special thanks to Sam Staton for his help in developing it, which involved many hours of entertaining my confusion regarding BLOG's not-comprehensively-documented semantics; and thanks to Stuart Russel's team for at least documenting some of it.
Links: