Added basic typing structure

This commit is contained in:
Marvin Kaiser
2019-11-04 15:41:32 +01:00
parent 8ad114107a
commit d14a7d7cbd
3 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package de.hsrm.compiler.Klang.types;
public class IntegerType extends PrimitiveType {
private static IntegerType instance = null;
public static IntegerType getType() {
if (instance != null) {
return instance;
}
instance = new IntegerType();
return instance;
}
@Override
public boolean isIntegerType() {
return true;
}
}

View File

@@ -0,0 +1,13 @@
package de.hsrm.compiler.Klang.types;
public abstract class PrimitiveType extends Type {
@Override
public boolean isPrimitiveType() {
return true;
}
public boolean isIntegerType() {
return false;
};
}

View File

@@ -0,0 +1,12 @@
package de.hsrm.compiler.Klang.types;
public abstract class Type {
// Returns an instance of IntegerType
// Used for adding new types to a node
public static IntegerType getIntegerType() {
return IntegerType.getType();
}
public abstract boolean isPrimitiveType();
}