Improving Clojure's Error Messages with Grammars
summary
Cursive parses unexpanded source with Parsing Expression Grammars to validate macro forms and produce actionable errors that point to file and column, mark syntax in the editor, and list what was expected. The prototype is an afternoon‑scale effort — about 200 lines of code — and returns structured captures for reuse across macros. The core compiler fixes that took years to land contrast with this approach; there are still 39 JIRAs open for error messages, so grammar‑based parsing scales far better.
AI-written summary · about
chapters (9)
- 0:00Introduction to Cursive
- 1:08The problem with error messages
- 2:24Macro parsing difficulties
- 6:37Analyzing JIRA and improvements
- 13:13Cursive's approach to parsing
- 17:10Implementing parsing expression grammars
- 26:33Error handling with PEGs
- 30:10Demonstrating the new parser
- 37:22Lessons from Elm and conclusion
related talks
27mParsing, Compiling, and Static Metaprogramming
20mAn Approach to Generate Text-Based IDEs for Syntax Correction based on Syntax Specification
28mAutomating the Automator
56mBuilding My Own Clojure Tools
29mMy Little Parser: Tooling is Magic
41mIntroducing a lightweight, data first Clojure interpreter for tracing code
40mIntelliJ Elixir Works Even if your Code Doesn't
38mLiving with Spec
