Prolog meets AsciiDoc: a parser shows up on GitHub

What landed
A new project on GitHub attempts something charmingly niche: parsing AsciiDoc using Prolog. The repository, authored by alexpdp7, includes an AsciiDoc-formatted writeup and code that demonstrates how to express AsciiDoc syntax as Prolog grammar rules. It has been reported that the project is discussed on Lobsters under the logiclangs tag, where language and parsing enthusiasts picked it up quickly.
How it works (in broad strokes)
Rather than reach for the usual suspects (Rust, JavaScript, or Python), the author leans on Prolog’s grammar and pattern-matching strengths to define AsciiDoc constructs. The writeup walks through rules for blocks, lists, and inline elements and shows how Prolog can build a parse tree that represents document structure. Expect examples that read like small executable grammars — concise, declarative, and suited to backtracking-based parsing.
Why anyone should care
Why Prolog for AsciiDoc? Because declarative grammars can be surprisingly expressive for document structure, and this project makes that argument in code you can run and tweak. For the logic-programming crowd it’s a delightful reminder that old tools still have new tricks. That said, one should be cautious: it’s allegedly not a drop-in replacement for full-featured AsciiDoc toolchains, and complete spec coverage and production readiness are not guaranteed.
Takeaway
If you’re a grammar nerd, a Prolog fan, or just curious about alternative parsing approaches, this is worth a look. The repo is readable and small enough to fork and experiment with — a nice playground for people who like digging under the hood of markup formats. Want to poke at edge cases or try converting the parser to SWI-Prolog or tuProlog? Go ahead — the project seems designed to invite that.
Sources: github.com/alexpdp7, Lobsters
Comments