There seems to be a little error in theThe Definitive ANTLR Reference p. 205: r.getTemplate() has to be cast to StringTemplate. The error is in the downloadable code, too. Thanks, Juergen