Code from book The Definitive ANTLR4 Reference