From b34b13d4852117db600b7ac2110a4867ded9ad9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krau=C3=9F=2C=20Josefine?= Date: Thu, 2 May 2024 13:12:39 +0200 Subject: [PATCH] abstract syntax tree as defined on 02.05.2024 --- Source/TypeCheck/AbstractType.java | 15 ++++++++ Source/TypeCheck/TypeCheckHelper.java | 23 ++++++++++++ Source/TypeCheck/TypeCheckResult.java | 7 ++++ .../abstractSyntaxTree/Class/FieldDecl.java | 4 ++ Source/abstractSyntaxTree/Class/IClass.java | 7 ++++ .../abstractSyntaxTree/Class/MethodDecl.java | 4 ++ .../Comment/CommentComment.java | 4 -- .../abstractSyntaxTree/Comment/IComment.java | 8 ---- .../Datatype/BoolDatatype.java | 4 +- .../Datatype/CharDatatype.java | 4 +- .../Datatype/IDatatype.java | 4 +- .../Datatype/IntDatatype.java | 4 +- .../abstractSyntaxTree/Datatype/RefType.java | 21 +++++++++++ .../Expression/AssignExpression.java | 4 -- .../Expression/BinaryExpression.java | 37 ++++++++++++++++++- .../Expression/IExpression.java | 4 +- .../Expression/MethodCall.java | 4 -- .../Modifier/IModifier.java | 3 +- .../Object/ClassObject.java | 4 -- .../Object/FieldDeclObject.java | 4 -- Source/abstractSyntaxTree/Object/IObject.java | 8 ---- .../Object/MethodeDeclObject.java | 4 -- .../abstractSyntaxTree/Object/NewObject.java | 4 -- .../abstractSyntaxTree/Object/ThisObject.java | 4 -- .../abstractSyntaxTree/Object/VoidObject.java | 4 -- .../Statement/AssignmentStatement.java | 4 -- .../Statement/BlockStatement.java | 9 ++++- .../Statement/BreakStatement.java | 4 -- .../Statement/ContinueStatement.java | 4 -- .../Statement/DoWhileStatement.java | 4 -- .../Statement/EmptyStatement.java | 9 ++++- .../Statement/ForStatement.java | 4 -- .../Statement/IStatement.java | 6 ++- .../Statement/IfElseStatement.java | 9 ++++- .../Statement/IfStatement.java | 9 ++++- .../Statement/ReturnStatement.java | 9 ++++- .../Statement/SwitchStatement.java | 6 --- .../Statement/WhileStatement.java | 9 ++++- .../StatementExpression/AssignExpression.java | 13 +++++++ .../StatementExpression/MethodCall.java | 13 +++++++ .../NewStatementExpression.java | 13 +++++++ 41 files changed, 224 insertions(+), 94 deletions(-) create mode 100644 Source/TypeCheck/AbstractType.java create mode 100644 Source/TypeCheck/TypeCheckHelper.java create mode 100644 Source/TypeCheck/TypeCheckResult.java create mode 100644 Source/abstractSyntaxTree/Class/FieldDecl.java create mode 100644 Source/abstractSyntaxTree/Class/IClass.java create mode 100644 Source/abstractSyntaxTree/Class/MethodDecl.java delete mode 100644 Source/abstractSyntaxTree/Comment/CommentComment.java delete mode 100644 Source/abstractSyntaxTree/Comment/IComment.java create mode 100644 Source/abstractSyntaxTree/Datatype/RefType.java delete mode 100644 Source/abstractSyntaxTree/Expression/AssignExpression.java delete mode 100644 Source/abstractSyntaxTree/Expression/MethodCall.java delete mode 100644 Source/abstractSyntaxTree/Object/ClassObject.java delete mode 100644 Source/abstractSyntaxTree/Object/FieldDeclObject.java delete mode 100644 Source/abstractSyntaxTree/Object/IObject.java delete mode 100644 Source/abstractSyntaxTree/Object/MethodeDeclObject.java delete mode 100644 Source/abstractSyntaxTree/Object/NewObject.java delete mode 100644 Source/abstractSyntaxTree/Object/ThisObject.java delete mode 100644 Source/abstractSyntaxTree/Object/VoidObject.java delete mode 100644 Source/abstractSyntaxTree/Statement/AssignmentStatement.java delete mode 100644 Source/abstractSyntaxTree/Statement/BreakStatement.java delete mode 100644 Source/abstractSyntaxTree/Statement/ContinueStatement.java delete mode 100644 Source/abstractSyntaxTree/Statement/DoWhileStatement.java delete mode 100644 Source/abstractSyntaxTree/Statement/ForStatement.java delete mode 100644 Source/abstractSyntaxTree/Statement/SwitchStatement.java create mode 100644 Source/abstractSyntaxTree/StatementExpression/AssignExpression.java create mode 100644 Source/abstractSyntaxTree/StatementExpression/MethodCall.java create mode 100644 Source/abstractSyntaxTree/StatementExpression/NewStatementExpression.java diff --git a/Source/TypeCheck/AbstractType.java b/Source/TypeCheck/AbstractType.java new file mode 100644 index 0000000..068b139 --- /dev/null +++ b/Source/TypeCheck/AbstractType.java @@ -0,0 +1,15 @@ +package TypeCheck; + +import TypeCheck.TypeCheckResult; + +public abstract class AbstractType { + TypeCheckResult typeCheckResult; + + public void setTypeCheckResult(TypeCheckResult typeCheckResult) { + this.typeCheckResult = typeCheckResult; + } + + public TypeCheckResult getTypeCheckResult() { + return typeCheckResult; + } +} diff --git a/Source/TypeCheck/TypeCheckHelper.java b/Source/TypeCheck/TypeCheckHelper.java new file mode 100644 index 0000000..e5a3a65 --- /dev/null +++ b/Source/TypeCheck/TypeCheckHelper.java @@ -0,0 +1,23 @@ +package TypeCheck; + +import java.util.Objects; + +public class TypeCheckHelper { + public String upperBound(String type1, String type2) throws Exception{ + boolean type1Primitiv = Objects.equals(type1, "bool") || Objects.equals(type1, "int") || Objects.equals(type1, "char"); + boolean type2Primitiv = Objects.equals(type2, "bool") || Objects.equals(type2, "int") || Objects.equals(type2, "char"); + + String result; + if(type1Primitiv && type2Primitiv){ + if(Objects.equals(type1, type2)){ + result = type1; + } + throw new Exception("no upper bound"); + }else if(type1Primitiv || type2Primitiv){ + throw new Exception("no upper bound"); + }else{ + result = "class"; + } + return result; + } +} diff --git a/Source/TypeCheck/TypeCheckResult.java b/Source/TypeCheck/TypeCheckResult.java new file mode 100644 index 0000000..160a797 --- /dev/null +++ b/Source/TypeCheck/TypeCheckResult.java @@ -0,0 +1,7 @@ +package TypeCheck; + +public class TypeCheckResult { + public String type; + public boolean valid; + +} diff --git a/Source/abstractSyntaxTree/Class/FieldDecl.java b/Source/abstractSyntaxTree/Class/FieldDecl.java new file mode 100644 index 0000000..c5d8ccd --- /dev/null +++ b/Source/abstractSyntaxTree/Class/FieldDecl.java @@ -0,0 +1,4 @@ +package abstractSyntaxTree.Class; + +public class FieldDecl implements IClass { +} diff --git a/Source/abstractSyntaxTree/Class/IClass.java b/Source/abstractSyntaxTree/Class/IClass.java new file mode 100644 index 0000000..cb1cf92 --- /dev/null +++ b/Source/abstractSyntaxTree/Class/IClass.java @@ -0,0 +1,7 @@ +package abstractSyntaxTree.Class; + +public interface IClass { + // not type or type check + + // visit method for code generation +} diff --git a/Source/abstractSyntaxTree/Class/MethodDecl.java b/Source/abstractSyntaxTree/Class/MethodDecl.java new file mode 100644 index 0000000..530ebec --- /dev/null +++ b/Source/abstractSyntaxTree/Class/MethodDecl.java @@ -0,0 +1,4 @@ +package abstractSyntaxTree.Class; + +public class MethodDecl implements IClass { +} diff --git a/Source/abstractSyntaxTree/Comment/CommentComment.java b/Source/abstractSyntaxTree/Comment/CommentComment.java deleted file mode 100644 index 096af14..0000000 --- a/Source/abstractSyntaxTree/Comment/CommentComment.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Comment; - -public class CommentComment { -} diff --git a/Source/abstractSyntaxTree/Comment/IComment.java b/Source/abstractSyntaxTree/Comment/IComment.java deleted file mode 100644 index c9089b7..0000000 --- a/Source/abstractSyntaxTree/Comment/IComment.java +++ /dev/null @@ -1,8 +0,0 @@ -package abstractSyntaxTree.Comment; - -public interface IComment { - // typeCheck method - // get type - - // visit method for code generation -} diff --git a/Source/abstractSyntaxTree/Datatype/BoolDatatype.java b/Source/abstractSyntaxTree/Datatype/BoolDatatype.java index 30fae6a..93a4b27 100644 --- a/Source/abstractSyntaxTree/Datatype/BoolDatatype.java +++ b/Source/abstractSyntaxTree/Datatype/BoolDatatype.java @@ -1,4 +1,6 @@ package abstractSyntaxTree.Datatype; -public class BoolDatatype implements IDatatype{ +import TypeCheck.AbstractType; + +public class BoolDatatype extends AbstractType implements IDatatype{ } diff --git a/Source/abstractSyntaxTree/Datatype/CharDatatype.java b/Source/abstractSyntaxTree/Datatype/CharDatatype.java index 87521a5..e5cca3f 100644 --- a/Source/abstractSyntaxTree/Datatype/CharDatatype.java +++ b/Source/abstractSyntaxTree/Datatype/CharDatatype.java @@ -1,4 +1,6 @@ package abstractSyntaxTree.Datatype; -public class CharDatatype implements IDatatype{ +import TypeCheck.AbstractType; + +public class CharDatatype extends AbstractType implements IDatatype{ } diff --git a/Source/abstractSyntaxTree/Datatype/IDatatype.java b/Source/abstractSyntaxTree/Datatype/IDatatype.java index 70e86d6..16c73d1 100644 --- a/Source/abstractSyntaxTree/Datatype/IDatatype.java +++ b/Source/abstractSyntaxTree/Datatype/IDatatype.java @@ -1,8 +1,10 @@ package abstractSyntaxTree.Datatype; +import TypeCheck.TypeCheckResult; + public interface IDatatype { // typeCheck method - // get type + TypeCheckResult typeCheck() throws Exception; // visit method for code generation } diff --git a/Source/abstractSyntaxTree/Datatype/IntDatatype.java b/Source/abstractSyntaxTree/Datatype/IntDatatype.java index 2b00988..f2f5d82 100644 --- a/Source/abstractSyntaxTree/Datatype/IntDatatype.java +++ b/Source/abstractSyntaxTree/Datatype/IntDatatype.java @@ -1,4 +1,6 @@ package abstractSyntaxTree.Datatype; -public class IntDatatype implements IDatatype{ +import TypeCheck.AbstractType; + +public class IntDatatype extends AbstractType implements IDatatype{ } diff --git a/Source/abstractSyntaxTree/Datatype/RefType.java b/Source/abstractSyntaxTree/Datatype/RefType.java new file mode 100644 index 0000000..2d9b23a --- /dev/null +++ b/Source/abstractSyntaxTree/Datatype/RefType.java @@ -0,0 +1,21 @@ +package abstractSyntaxTree.Datatype; + +import TypeCheck.AbstractType; +import TypeCheck.TypeCheckResult; +import abstractSyntaxTree.Class.FieldDecl; +import abstractSyntaxTree.Class.MethodDecl; + +import java.util.List; + +public class RefType extends AbstractType implements IDatatype { + public RefType(List fieldDecls, List methodDecls){ + this.fieldDecls = fieldDecls; + this.methodDecls = methodDecls; + } + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } + List fieldDecls; + List methodDecls; +} diff --git a/Source/abstractSyntaxTree/Expression/AssignExpression.java b/Source/abstractSyntaxTree/Expression/AssignExpression.java deleted file mode 100644 index 19364bd..0000000 --- a/Source/abstractSyntaxTree/Expression/AssignExpression.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Expression; - -public class AssignExpression implements IExpression{ -} diff --git a/Source/abstractSyntaxTree/Expression/BinaryExpression.java b/Source/abstractSyntaxTree/Expression/BinaryExpression.java index b531823..2ab005f 100644 --- a/Source/abstractSyntaxTree/Expression/BinaryExpression.java +++ b/Source/abstractSyntaxTree/Expression/BinaryExpression.java @@ -1,4 +1,39 @@ package abstractSyntaxTree.Expression; -public class BinaryExpression implements IExpression{ +import TypeCheck.TypeCheckResult; +import TypeCheck.TypeCheckHelper; +import TypeCheck.AbstractType; + +import java.util.Objects; + +public class BinaryExpression extends AbstractType implements IExpression{ + + + public String operator; + public IExpression left; + public IExpression right; + + @Override + public TypeCheckResult typeCheck() throws Exception { + TypeCheckHelper helper = new TypeCheckHelper(); + TypeCheckResult result = new TypeCheckResult(); + + TypeCheckResult leftType = left.typeCheck(); + TypeCheckResult rightType = right.typeCheck(); + + switch (operator) { + case "and": + case "or" :{ + if (Objects.equals(helper.upperBound(leftType.type, rightType.type), "bool")){ + result.valid = true; + result.type = "bool"; + } + break; + } + // ==, != + } + + setTypeCheckResult(result); // writes to attribute in abstract type class + return result; + } } diff --git a/Source/abstractSyntaxTree/Expression/IExpression.java b/Source/abstractSyntaxTree/Expression/IExpression.java index 8d33cfd..ba2b9c9 100644 --- a/Source/abstractSyntaxTree/Expression/IExpression.java +++ b/Source/abstractSyntaxTree/Expression/IExpression.java @@ -1,8 +1,10 @@ package abstractSyntaxTree.Expression; +import TypeCheck.TypeCheckResult; + public interface IExpression { // typeCheck method - // get type + TypeCheckResult typeCheck() throws Exception; // visit method for code generation } diff --git a/Source/abstractSyntaxTree/Expression/MethodCall.java b/Source/abstractSyntaxTree/Expression/MethodCall.java deleted file mode 100644 index 45a8748..0000000 --- a/Source/abstractSyntaxTree/Expression/MethodCall.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Expression; - -public class MethodCall implements IExpression{ -} diff --git a/Source/abstractSyntaxTree/Modifier/IModifier.java b/Source/abstractSyntaxTree/Modifier/IModifier.java index ee2f6ce..e201d50 100644 --- a/Source/abstractSyntaxTree/Modifier/IModifier.java +++ b/Source/abstractSyntaxTree/Modifier/IModifier.java @@ -1,8 +1,7 @@ package abstractSyntaxTree.Modifier; public interface IModifier { - // typeCheck method - // get type + // not type or type check // visit method for code generation } diff --git a/Source/abstractSyntaxTree/Object/ClassObject.java b/Source/abstractSyntaxTree/Object/ClassObject.java deleted file mode 100644 index cd7383d..0000000 --- a/Source/abstractSyntaxTree/Object/ClassObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class ClassObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Object/FieldDeclObject.java b/Source/abstractSyntaxTree/Object/FieldDeclObject.java deleted file mode 100644 index 50c0532..0000000 --- a/Source/abstractSyntaxTree/Object/FieldDeclObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class FieldDeclObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Object/IObject.java b/Source/abstractSyntaxTree/Object/IObject.java deleted file mode 100644 index eb4bbbf..0000000 --- a/Source/abstractSyntaxTree/Object/IObject.java +++ /dev/null @@ -1,8 +0,0 @@ -package abstractSyntaxTree.Object; - -public interface IObject { - // typeCheck method - // get type - - // visit method for code generation -} diff --git a/Source/abstractSyntaxTree/Object/MethodeDeclObject.java b/Source/abstractSyntaxTree/Object/MethodeDeclObject.java deleted file mode 100644 index 8c432c0..0000000 --- a/Source/abstractSyntaxTree/Object/MethodeDeclObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class MethodeDeclObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Object/NewObject.java b/Source/abstractSyntaxTree/Object/NewObject.java deleted file mode 100644 index 774c5e2..0000000 --- a/Source/abstractSyntaxTree/Object/NewObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class NewObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Object/ThisObject.java b/Source/abstractSyntaxTree/Object/ThisObject.java deleted file mode 100644 index f8bf4e5..0000000 --- a/Source/abstractSyntaxTree/Object/ThisObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class ThisObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Object/VoidObject.java b/Source/abstractSyntaxTree/Object/VoidObject.java deleted file mode 100644 index 6154097..0000000 --- a/Source/abstractSyntaxTree/Object/VoidObject.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Object; - -public class VoidObject implements IObject{ -} diff --git a/Source/abstractSyntaxTree/Statement/AssignmentStatement.java b/Source/abstractSyntaxTree/Statement/AssignmentStatement.java deleted file mode 100644 index e532264..0000000 --- a/Source/abstractSyntaxTree/Statement/AssignmentStatement.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Statement; - -public class AssignmentStatement implements IStatement{ -} diff --git a/Source/abstractSyntaxTree/Statement/BlockStatement.java b/Source/abstractSyntaxTree/Statement/BlockStatement.java index f11e524..51ce21d 100644 --- a/Source/abstractSyntaxTree/Statement/BlockStatement.java +++ b/Source/abstractSyntaxTree/Statement/BlockStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class BlockStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class BlockStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/Statement/BreakStatement.java b/Source/abstractSyntaxTree/Statement/BreakStatement.java deleted file mode 100644 index f16f679..0000000 --- a/Source/abstractSyntaxTree/Statement/BreakStatement.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Statement; - -public class BreakStatement implements IStatement{ -} diff --git a/Source/abstractSyntaxTree/Statement/ContinueStatement.java b/Source/abstractSyntaxTree/Statement/ContinueStatement.java deleted file mode 100644 index 08aace9..0000000 --- a/Source/abstractSyntaxTree/Statement/ContinueStatement.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Statement; - -public class ContinueStatement implements IStatement{ -} diff --git a/Source/abstractSyntaxTree/Statement/DoWhileStatement.java b/Source/abstractSyntaxTree/Statement/DoWhileStatement.java deleted file mode 100644 index 6da7d86..0000000 --- a/Source/abstractSyntaxTree/Statement/DoWhileStatement.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Statement; - -public class DoWhileStatement implements IStatement{ -} diff --git a/Source/abstractSyntaxTree/Statement/EmptyStatement.java b/Source/abstractSyntaxTree/Statement/EmptyStatement.java index 2fa72a3..ae307ff 100644 --- a/Source/abstractSyntaxTree/Statement/EmptyStatement.java +++ b/Source/abstractSyntaxTree/Statement/EmptyStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class EmptyStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class EmptyStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/Statement/ForStatement.java b/Source/abstractSyntaxTree/Statement/ForStatement.java deleted file mode 100644 index 953e5b2..0000000 --- a/Source/abstractSyntaxTree/Statement/ForStatement.java +++ /dev/null @@ -1,4 +0,0 @@ -package abstractSyntaxTree.Statement; - -public class ForStatement implements IStatement{ -} diff --git a/Source/abstractSyntaxTree/Statement/IStatement.java b/Source/abstractSyntaxTree/Statement/IStatement.java index 9454c6c..daa669a 100644 --- a/Source/abstractSyntaxTree/Statement/IStatement.java +++ b/Source/abstractSyntaxTree/Statement/IStatement.java @@ -1,8 +1,10 @@ package abstractSyntaxTree.Statement; +import TypeCheck.TypeCheckResult; + public interface IStatement { - // typeCheck method - // get type + + TypeCheckResult typeCheck() throws Exception; // visit method for code generation } diff --git a/Source/abstractSyntaxTree/Statement/IfElseStatement.java b/Source/abstractSyntaxTree/Statement/IfElseStatement.java index 186742a..9eca30a 100644 --- a/Source/abstractSyntaxTree/Statement/IfElseStatement.java +++ b/Source/abstractSyntaxTree/Statement/IfElseStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class IfElseStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class IfElseStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/Statement/IfStatement.java b/Source/abstractSyntaxTree/Statement/IfStatement.java index 9d97e37..38a0467 100644 --- a/Source/abstractSyntaxTree/Statement/IfStatement.java +++ b/Source/abstractSyntaxTree/Statement/IfStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class IfStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class IfStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/Statement/ReturnStatement.java b/Source/abstractSyntaxTree/Statement/ReturnStatement.java index 40f7b9d..2e23608 100644 --- a/Source/abstractSyntaxTree/Statement/ReturnStatement.java +++ b/Source/abstractSyntaxTree/Statement/ReturnStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class ReturnStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class ReturnStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/Statement/SwitchStatement.java b/Source/abstractSyntaxTree/Statement/SwitchStatement.java deleted file mode 100644 index 02991e8..0000000 --- a/Source/abstractSyntaxTree/Statement/SwitchStatement.java +++ /dev/null @@ -1,6 +0,0 @@ -package abstractSyntaxTree.Statement; - -import java.sql.Statement; - -public class SwitchStatement implements IStatement { -} diff --git a/Source/abstractSyntaxTree/Statement/WhileStatement.java b/Source/abstractSyntaxTree/Statement/WhileStatement.java index e6c2371..7788902 100644 --- a/Source/abstractSyntaxTree/Statement/WhileStatement.java +++ b/Source/abstractSyntaxTree/Statement/WhileStatement.java @@ -1,4 +1,11 @@ package abstractSyntaxTree.Statement; -public class WhileStatement implements IStatement{ +import TypeCheck.TypeCheckResult; +import TypeCheck.AbstractType; + +public class WhileStatement extends AbstractType implements IStatement{ + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } } diff --git a/Source/abstractSyntaxTree/StatementExpression/AssignExpression.java b/Source/abstractSyntaxTree/StatementExpression/AssignExpression.java new file mode 100644 index 0000000..672011e --- /dev/null +++ b/Source/abstractSyntaxTree/StatementExpression/AssignExpression.java @@ -0,0 +1,13 @@ +package abstractSyntaxTree.StatementExpression; + +import TypeCheck.AbstractType; +import TypeCheck.TypeCheckResult; +import abstractSyntaxTree.Expression.IExpression; +import abstractSyntaxTree.Statement.IStatement; + +public class AssignExpression extends AbstractType implements IExpression, IStatement { + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } +} diff --git a/Source/abstractSyntaxTree/StatementExpression/MethodCall.java b/Source/abstractSyntaxTree/StatementExpression/MethodCall.java new file mode 100644 index 0000000..b019b70 --- /dev/null +++ b/Source/abstractSyntaxTree/StatementExpression/MethodCall.java @@ -0,0 +1,13 @@ +package abstractSyntaxTree.StatementExpression; + +import TypeCheck.AbstractType; +import TypeCheck.TypeCheckResult; +import abstractSyntaxTree.Expression.IExpression; +import abstractSyntaxTree.Statement.IStatement; + +public class MethodCall extends AbstractType implements IExpression, IStatement { + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } +} diff --git a/Source/abstractSyntaxTree/StatementExpression/NewStatementExpression.java b/Source/abstractSyntaxTree/StatementExpression/NewStatementExpression.java new file mode 100644 index 0000000..915ee84 --- /dev/null +++ b/Source/abstractSyntaxTree/StatementExpression/NewStatementExpression.java @@ -0,0 +1,13 @@ +package abstractSyntaxTree.StatementExpression; + +import TypeCheck.AbstractType; +import TypeCheck.TypeCheckResult; +import abstractSyntaxTree.Expression.IExpression; +import abstractSyntaxTree.Statement.IStatement; + +public class NewStatementExpression extends AbstractType implements IExpression, IStatement { + @Override + public TypeCheckResult typeCheck() throws Exception { + return null; + } +}