[antlr-interest] CommonTree vs CommonAST

Terence Parr parrt at cs.usfca.edu
Sat Sep 24 09:36:05 PDT 2011

Hi. I'm working on the v4 runtime and, since I have introduced a formal notion of the parse tree, some naming changes seem reasonable. I created interface Tree, which is generic. Then I introduced ParseTree. "Tree" is such a generic term and might conflict with ParseTree I've changed the abstract syntax tree stuff back to AST (like in v2). Here is the complete hierarchy:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.tiff
Type: image/tiff
Size: 57318 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20110924/7492fe1b/attachment.tiff 
-------------- next part --------------

So CommonTree in v3 becomes CommonAST in v4. I don't like gratuitous breaking changes. I could leave an alias for CommonTree (subclass CommonAST), but it would not be a perfect replacement due to type compatibility.

Q:  is it better to leave CommonTree as CommonTree for backward compatibility or is it better to use CommonAST in order to make it more clear we are distinguishing between parse trees and abstract syntax tree?

A name change also requires changes in the tree adapter stuff... that has to become ASTAdaptor, CommonASTAdaptor... more breaking changes at the type name level...grrr...


More information about the antlr-interest mailing list