Your example requires that expr be following by a newline character. In your sample input, no newline character is given, so the parse tree contains error nodes.
Also note that you didn’t provide an implementation for VisitProg or VisitStat in your visitor.
The default behavior for the visitor, in combination with error nodes appearing in your parse tree, is producing the null return value you are observing.
Sam
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.