[antlr-interest] Any way to introduce a base class for TreeParser/Lexer/Parser?

Terence Parr parrt at cs.usfca.edu
Wed Jun 1 11:39:12 PDT 2005


On Jun 1, 2005, at 10:18 AM, Gerald B. Rosenberg wrote:

> I would like to remove as much as possible the action code from the  
> grammar file.

A worthy goal :)

> This could be easily done if, in the grammar file, I could specify  
> that the TreeParser (or Parser or Lexer) extends from my own custom  
> action library class that otherwise maintains the necessary class  
> hierarchy, i.e., inherits from antlr.TreeParser.  Seems that the  
> "extends" clauses are referencing keywords rather than actual class  
> names.

I believe

class Foo extends Parser(GeraldsCoolSuperClass);

will work.

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list