'From Squeak3.8alpha of ''17 July 2004'' [latest update: #6229] on 24 September 2004 at 1:24:10 pm'! "Change Set: RBVisitorComment Date: 24 September 2004 Author: Marcus Denker Adds a comment to the RB VisitorClass, removes the new in RBProgramNodeVisitor class"! !RBProgramNodeVisitor commentStamp: 'md 9/24/2004 12:36' prior: 0! Here is a short Tutorial. We want to parse an expression: tree := RBParser parseExpression: '3 + 4' Now we have the AST (Abstrakt syntax tree). Have a look at it with the ObjectExplorerer: tree explore We can easyly walk across the tree using the RBProgramNodeVisitor: RBProgramNodeVisitor new visitNode: tree. Of course, nothing happens, as all the visitor-methods are only stubs in this class. So you need to subclass that to do anything usefull. As an example, we would like to walk the tree and get all Literals back. So we make a subclass: RBProgramNodeVisitor subclass: #TestVisitor instanceVariableNames: 'literals' classVariableNames: '' poolDictionaries: '' category: 'Compiler-AST-Visitors' initialize literals := Set new. literals ^literals acceptLiteralNode: aLiteralNode literals add: aLiteralNode value. (TestVisitor new visitNode: tree) literals ! RBProgramNodeVisitor class removeSelector: #new! !RBProgramNodeVisitor class reorganize! ('as yet unclassified') !