Improving Clojure's Error Messages with Grammars - Colin Fleming
4,467 views · Published 16 November 2015 · 40:53 · Indexed 25 October 2026
Channel: ClojureTV · 2015 · Science & Technology
One of the most frequent complaints from new users of Clojure is the error messages. But many of the error messages that users are faced with are not actually errors from the core language at all but instead surface from macro parsing code. This parsing code is often brittle, difficult to write and can produce truly awful errors. Cursive is a Clojure IDE which works from unexpanded source. It uses Parsing Expression Grammars to parse macro forms, which makes the parsing code much quicker to write and also dramatically increases its composability and reusability. Additionally this allows much better error reporting. Syntax errors can be identified at the point the error occurs with much friendlier messages. Achieving better error reporting requires little extra work by the developer. Cursive can use this information to mark syntax errors in the editor and provide information about what was expected at the error point. I'll show a lot of examples of the grammars that Cursive uses and also the code that uses them. I'll also discuss the benefits from using this technique for more general macro parsing - I now believe we should parse all macros this way. About the speaker: Colin is the developer of Cursive. He has programmed things for a long time now, and came to Clojure from Java via Scheme a few years ago. When he's not hacking on Cursive he's mostly waiting for his daughter to get old enough to program robots together.
More from this channel
-
18:41
Fertile Ground, the Roots of Clojure - Michael Fogus
-
39:41
Lisp, Functional Programming, and the State of Flow - Tom Faulhaber
-
39:17
Protocol XIII: Clojure Protocols Explained - Sean Devlin
-
5:23
Aleph: A Framework for AsynchronousCommunication - Zach Tellman
-
26:57
Clojure and Android - Daniel Solano Gomez
-
38:24
Performance in the Wild - Craig Andera
-
41:18
Concurrent Stream Processing - David McNeil
-
42:20
Ousterhout's Dichotomy Isn't (Part 2 of the Simplicity/Power/Focus Series) - Stuart Halloway