{
  "id": 9550031,
  "title": "Parsing Expression Grammar vs. regexes: Building Org parser in Lisp that exports to HTML (via SXML)",
  "url": "https://urgent.news/2026/09/24/parsing-expression-grammar-vs-regexes-building-org-parser-in-lisp",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-24T12:11:25.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://jointhefreeworld.org/blog/articles/lisps/parsing-expression-grammar-lisp-org-convert-to-html/index.html"
  },
  "original_language": "en",
  "account": "In this blog post, the author describes their journey in building OrgWebAlchemy, a Guile Scheme library for parsing Org-mode documents into an Abstract Syntax Tree (AST) and rendering them to HTML. Initially, the author tried using regular expressions for parsing, but soon realized that a more sophisticated approach was needed. This led them to explore Parsing Expression Grammars (PEGs) using Guile's (ice-9 peg) module and the tutorials available.\n\nThe author appreciates the readability of PEG grammars as documentation for the language and the benefit of having the grammar and HTML rendering as separate concerns. This allows for future expansion to support other formats like Markdown.\n\nThe parsing process begins with a flat sequence of list items, which are then organized into a nested structure in the AST based on indentation levels. The HTML renderer then takes the AST and produces the final HTML output. Although the library currently supports a subset of Org-mode features, the author is confident about its stability after reaching version 1.0.\n\nThe SXML format is used for representing the HTML output because, being within the Lisp ecosystem, it allows for a more natural representation of the markup tree. The author emphasizes the flexibility of allowing full customization of the output HTML through Guile parameters, enabling easy integration into various projects.\n\nThe project is open-source, licensed under the GNU LGPL v3 or later, and the code is available on Codeberg. The author invites feedback on various aspects of the project, including the grammar, AST design, parser architecture, and any Org constructs they may have overlooked. The inclusion of a test suite in the repository serves as a safety net and showcases the parser's capabilities.",
  "summary": null,
  "key_points": [
    "Author builds OrgWebAlchemy, a Guile Scheme library for parsing Org-mode documents.",
    "Uses SXML format for HTML output, allowing customization through Guile parameters."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}