summaryrefslogtreecommitdiff
path: root/Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java')
-rw-r--r--Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java b/Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java
new file mode 100644
index 0000000..c640718
--- /dev/null
+++ b/Homework/cs5300/compiler/p5-compiler/submit/SymbolInfo.java
@@ -0,0 +1,43 @@
+/*
+ * Code formatter project
+ * CS 4481
+ */
+package submit;
+
+import submit.ast.VarType;
+
+/**
+ *
+ * @author edwajohn
+ */
+public class SymbolInfo {
+
+ private final String id;
+ // In the case of a function, type is the return type
+ private final VarType type;
+ private final boolean function;
+ private int offset;
+
+ public SymbolInfo(String id, VarType type, boolean function) {
+ this.id = id;
+ this.type = type;
+ this.function = function;
+ }
+
+ public SymbolInfo(String id, VarType type, boolean function, int offset) {
+ this(id, type, function);
+ this.offset = offset;
+ }
+
+ @Override
+ public String toString() {
+ return "<" + id + ", " + type + '>';
+ }
+
+ public VarType getType() { return type; }
+
+ public boolean isFunction() { return function; }
+
+ public int getOffset() { return offset; }
+ public void setOffset(int offset) { this.offset = offset; }
+}