Using ANTLR you can extend an existing grammar (grammar inheritance).
In order for this to work, ANTLR must be passed a -glib flag naming
the grammar files to be scanned for the supergrammars. This flag
should be settable as an option and the default value should be based
on the list of ANTLR grammars already declared via the "maven.antlr.grammars" property.
From the ANTLR documentation:
The set of potential "supergrammars" available to some grammar P includes any other grammar in the same file as P and any listed on the ANTLR command line with
-glib f1.g;f2.g
where the files must include path names if they are located in another directory.