Compilers and Parsing

April 22, 2010

I’ve always been fascinated by compilers. They seem almost magical, translating some source language to a target language or object code. And even though I understand how they work, it’s still looks like magic. Compilation relies on parsing, which is one of the more difficult parts of a typical compiler. There are several ways to do parsing, most of them using some automated code generation tools (the classics being lex (techinally the scanner, or tokenizer) and yacc (the parser), with later versions fondly named flex and bison). One way to write a parser is known as a...