Let’s Write a Parser!
One weird trick to write parsers. Compiler engineers will hate you!
Parsers are programs that transform input data — usually text, but also binary — into in-memory data structures — normally trees — amenable to further processing.
They’re one of those special topics of our field. Most everyone regards parsers as magic and the goto choice for implementing them seem to be regular expressions, but they’re only part of the answer, not the whole picture.
This session, organized in two parts, will present a systematic and down-to-earth method of building parsers. In the first part we’ll present the high-level concepts and the overall flow of data, while in the second we’ll write a parser for a subset of Standard ML, a simple functional programming language with enough structure to be interesting for our purpose.
At the end of the session, you should be better prepared to approach the construction of parsers for mildly complicated input formats or languages.
Finally, it’s neither a weird trick, nor any compiler engineer will hate you, but it’s fun to mock those annoying advertisement campaigns.
Who is it for?