-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathValue.java
More file actions
36 lines (33 loc) · 1.14 KB
/
Value.java
File metadata and controls
36 lines (33 loc) · 1.14 KB
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
34
35
36
package com.compilerprogramming.ezlang.interpreter;
import com.compilerprogramming.ezlang.types.EZType;
import java.util.ArrayList;
public class Value {
static public class IntegerValue extends Value {
public IntegerValue(long value) {
this.value = value;
}
public final long value;
}
static public class NullValue extends Value {
public NullValue() {}
}
static public class ArrayValue extends Value {
public final EZType.EZTypeArray arrayType;
public final ArrayList<Value> values;
public ArrayValue(EZType.EZTypeArray arrayType, long len, Value initValue) {
this.arrayType = arrayType;
values = new ArrayList<>();
for (long i = 0; i < len; i++) {
values.add(initValue);
}
}
}
static public class StructValue extends Value {
public final EZType.EZTypeStruct structType;
public final Value[] fields;
public StructValue(EZType.EZTypeStruct structType) {
this.structType = structType;
this.fields = new Value[structType.numFields()];
}
}
}