


































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



































94
96
class FSM { State state; public FSM(State s) { state = s; } public void move(char c) { state = state.move(c); } public boolean accept() { return state.accept();} } public interface State { State move(char c); boolean accept(); }
100
102
106
G g G g … User Display Objects column row row column row row
108
112
114
118
120
124
public interface Node { } public class Number extends Node { public int n; } public class Plus extends Node{ public Node left; public Node right; }
public interface Node { public int sum(); } public class Number extends Node { public int n; public int sum() { return n; } } public class Plus { public Node left; public Node right; public int sum() { return left.sum() + right.sum(); } }
126
One method for each analysis
130
aNodeStructure aAssignmentNode aVariableRefNode aTypeCheckingVisitor Accept (aTypeChecking Visitor) VisitAssignment(aAssignmentNode) VisitVariableRef (aVariableRefNode) Accept (aTypeCheckingVisitor) someOperation() someOperation()
132