Parsing layout – problems with Haskell's syntax (2021)
amelia.how
amelia.how
One of the things I learned was that even though I would have described myself as comfortable writing Haskell code... I sure never learned all of the fundamentals of how it is parsed.
All of the details are in the article - all of them - so there's a lot I didn't read. If I were implementing a parser, I read this carefully.
The most interesting part was the explanation that parsing this statement:
foo = let x = 1 in x
involves realizing that one interpretation leads to a parse error, so an extra closing brace } should be emitted at the end.https://web.archive.org/web/20211015184656/https://abby.how/...