HACKER Q&A
📣 Maha-pudma

Good resources/books for learning about parsing


As the title says. I'm fairly new to programming. I attempted to write a script to transform html to zim-wiki format (I am aware of things like pandoc and other scripts already in existence) and a learning experience. Zim-wiki formatting is fairly simple so I thought, naively, it would be easy-ish whilst still challenging me.

Anyway I have a script that mostly works using string replacement and regex but things like nested lists, lists with multiple lines per item and tables are proving challenging for someone of my level of programming skill. So I thought I need to do some learning.

When I search for text parsing the results mostly point me towards existing libraries that do it for you but I want to learn actually how to do it myself.

Thanks in advance.


  👤 strangecasts Accepted Answer ✓
The opening chapters of Crafting Interpreters (http://craftinginterpreters.com/) deal with building a parser for a programming language, and goes into challenges similar to what you're dealing with (e.g. maintaining state in the parser to separate comments from code).