flex

tpl2cpp and tpl2rem are written in flex

flex25.pdf
flex 2.5.4 manual
flex2535.pdf
flex 2.5.35 manual
compiler.pdf
Compiler Construction using Flex and Bison (Aaby 2004)