This is just a sketch for reducing this redundancy. Don't know whether this is good, but it looks like its less dsl code. The idea here, would be to first import all entities from imported modules and then start the substitution. This might make things easier....
Will try refactoring the model first instead. It might be more understandable if you'd create two to three model files instead. Each focusing on one aspect: Parsing, ParserListener and ErrorListener.
There may appear a lot of redundancy when using substitution. The question is whether it is worth addressing by changing the copy & replace mechanism.
Consider an example as follows from antlr.demo.MegaLChecker.megal
This is just a sketch for reducing this redundancy. Don't know whether this is good, but it looks like its less dsl code. The idea here, would be to first import all entities from imported modules and then start the substitution. This might make things easier....