[antlr-interest] Complaints about BaseAST implementation

Martin Probst mail at martin-probst.com
Tue Oct 11 23:55:15 PDT 2005


Hi,

I agree with you, except this sounds a little strange:

> So, either all classes deriving from BaseAST should
> implement get/set child/sibling AND get/set text/type,
> OR a minimal concrete class can be provided that
> derives from BaseAST (other classes derive from this
> concrete class) and implements node connectivity
> (right/down) and returns empty string and 0
> respectively for getText() and getType(). Again,
> implementing them in BaseAST is incorrect. It is an
> abstract class and *must not* have any say in things
> it  has no info about.

Why would you create a _concrete_ class, and then have it return bogus
values on two method calls? Who should instantiate that class? I guess
it should be abstract, don't you think?

Martin



More information about the antlr-interest mailing list