Syntax errors

Module name: blackbird.error

This module contains the class BlackbirdErrorListener, which inherits the standard ANTLR4 error listener, and overrides the default syntaxError method.

This custom listener enables us to:

  1. Remove the extraneous Python traceback, which we generally do not want users to see.

  2. Replace some common ANTLR error messages, which can be a bit obfuscating, with ones that are more informative.

Note that we do not try and replace all error messages, just the more common ones that the user is likely to come across.



A generic exception with no traceback provided


Blackbird syntax error exception


Custom error listener for Blackbird

Code details

exception NoTraceBack(msg)[source]

A generic exception with no traceback provided


Method executed when the exception is called.


msg (str) – message to be printed in the traceback


list of weak references to the object (if defined)

exception BlackbirdSyntaxError(msg)[source]

Blackbird syntax error exception

class BlackbirdErrorListener[source]

Custom error listener for Blackbird