Parsing AsciiDoc in Prolog
9 points by jmiven
9 points by jmiven
Hah, I forgot to celebrate someone submitting my stuff here for the first time!
I'm a bit embarrassed I've forgotten most of what I wrote about parsing. And much of it is likely wrong or bad advice. But I had some fun making some AsciiDoc parsing work. My intuition still says Prolog might be a very good choice to parse these kinds of languages, but really I have no solid knowledge to back that up.
I fell in love with Prolog about a quarter of a century ago. Although you ultimately realize it's not magic and it's quite limited, it's a trip. It is one of my go-to recommendations for people who want to try something new.
The main limitation with DCG-parsing (and, frankly, with Prolog overall) is that in case of parsing error it won’t tell you the position of the error, it simply tells you “failed to parse” (false).
Oh, I think I hadn't realized this when writing the article- good to know! However, AsciiDoc, Markdown, and other similar languages do not have parsing errors, as far as I know.