Using the heterogenous tree construction facility, how can I force all the AST nodes created be of type MyASTNode thereby doing away the required casting from AST*?

Terence Parr

Forcing all tree nodes to be the same kind of object makes them homogeneous trees not heterogeneous trees. If you are asking how to get ANTLR to generate variable references as MyASTNode, then just use the grammar option "ASTLabelType=MyASTNode".

If you want to create nodes of type MyASTNode by default (individual token references can override the default to create special nodes) then call parser.setASTNodeClass("MyASTNode") before invoking the parser.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact