Parsec is what originally got me interested in Haskell. I had played around with it via LYAH [0] before, but never really got into it. I wanted to write a compiler for a language I was playing with, and seeing Parsec convinced me I should dive in and learn Haskell, as it just lets you write parsers in an incredibly intuitive and quick way; for me at least, parser combinator libraries are much easier to use than parser generators, and are also a lot more modular.
Even if you're familiar with parsec and parsing in Haskell, this post includes a fairly good explanation of De Bruijn indices. I've seen them a few times already but this explanation made it click particularly well.
Interestingly enough, I've been playing around with parsing the same thing lately, albeit in Python with a simple recursive descent parser (with exceptions for control flow, which actually works surprisingly well.)
A lot of the same ideas. And indeed, much of the parser is pretty close to the same:
Oof, that's my mistake, I didn't notice that the indexing system TAPL uses starts at 0, while Wikipedia starts at 1. I'll add a note about that to the post now.
Even if you're familiar with parsec and parsing in Haskell, this post includes a fairly good explanation of De Bruijn indices. I've seen them a few times already but this explanation made it click particularly well.
[0] Learn You a Haskell: http://learnyouahaskell.com/