Posted By:
Curtis_Clifton
Posted On:
Wednesday, June 6, 2001 10:16 AM
I have several grammars where the generated parsers need to share some functionality. I would like create an abstract parser class, MyAbstractParser , that subclasses antlr.LLkParser . Then the parsers generated from my grammar files should extend MyAbstractParser . I haven't found a way to do this in ANTLR and would appreciate suggestions. I'm working on a compiler for MultiJava (a conservative extension to Java with open classes and multiple dispatch). My compiler is based on the Kopi Java compiler (kjc). The good folks at DMS who developed kjc used a customized version of ANTLR. I am working to switch to the standard ANTLR so I can take advantage of updates and bug fixes. kjc uses the pattern I described a
More>>
I have several grammars where the generated parsers need to share some functionality. I would like create an abstract parser class,
MyAbstractParser
, that subclasses
antlr.LLkParser
. Then the parsers generated from my grammar files should extend
MyAbstractParser
.
I haven't found a way to do this in ANTLR and would appreciate suggestions.
I'm working on a compiler for MultiJava (a conservative extension to Java with open classes and multiple dispatch). My compiler is based on the Kopi Java compiler (kjc). The good folks at DMS who developed kjc used a customized version of ANTLR. I am working to switch to the standard ANTLR so I can take advantage of updates and bug fixes. kjc uses the pattern I described above (i.e., abstract parser class). It accomplishes this by adding a new option to ANTLR:
superClass = "at.dms.compiler.Parser"
If there isn't a clean technique that accomplishes the same thing in ANTLR, what are the chances of the functionality being added? I would be more than happy to submit the necessary patches.
-- Curt
<<Less