forked from ragibson/miniJava-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAST.java
More file actions
33 lines (25 loc) · 808 Bytes
/
AST.java
File metadata and controls
33 lines (25 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* miniJava Abstract Syntax Tree classes
* @author prins
* @version COMP 520 (v2.2)
*/
package miniJava.AbstractSyntaxTrees;
import miniJava.SyntacticAnalyzer.SourcePosition;
public abstract class AST {
TypeDenoter type = null;
public AST(SourcePosition posn) {
this.posn = posn;
if (posn == null) {
this.posn = new SourcePosition();
}
}
public String toString() {
String fullClassName = this.getClass().getName();
String cn = fullClassName.substring(1 + fullClassName.lastIndexOf('.'));
if (ASTDisplay.showPosition)
cn = cn + " " + posn.toString();
return cn;
}
public abstract <A, R> R visit(Visitor<A, R> v, A o);
public SourcePosition posn;
}