In this hands-on session we will implement a simple parser combinator library from scratch.
In a short introduction we will explain what parser are, why they are useful, and how they can naturally be viewed as functions. When we start coding together, we will define basic parsers and combine them into more powerful parsers by using the composition mechanisms of functional programming.
At the the end we will be able to build a parser for arithmetic expressions such as this:
((1) ) * (2+( ((3 ))) *(4+ ( ( ( 5 )) + 6 ))* ( ((7 * 8 ) ) )+ 9 )
We will develop this in a TDD (as in test-driven) fashion. But don't worry, the tests have already been written for you. :)
- Understand what parser combinators are
- Learn how to apply one of the most powerful concepts of functional programming: composition
- Develop an easier access to other battle tested parser libraries
- Have fun!
- Please bring a laptop with a working Scala development environment. If you don't have a working Scala environment, check out our intro to Scala: https://github.com/scaladus/scala-kickstart