diff --git a/src/main/java/de/maishai/ast/Assignment.java b/src/main/java/de/maishai/ast/Assignment.java new file mode 100644 index 0000000..8976a3f --- /dev/null +++ b/src/main/java/de/maishai/ast/Assignment.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Statement; + +public record Assignment(Location loc, Expression value) implements Statement { +} diff --git a/src/main/java/de/maishai/ast/Binary.java b/src/main/java/de/maishai/ast/Binary.java new file mode 100644 index 0000000..d961418 --- /dev/null +++ b/src/main/java/de/maishai/ast/Binary.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Operator; + +public record Binary(Expression left, Operator op, Expression right) implements Expression{ +} diff --git a/src/main/java/de/maishai/ast/Block.java b/src/main/java/de/maishai/ast/Block.java new file mode 100644 index 0000000..f07dc9e --- /dev/null +++ b/src/main/java/de/maishai/ast/Block.java @@ -0,0 +1,9 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Node; +import de.dhbw.horb.ast.Statement; + +import java.util.List; + +public record Block(List vars, List stmts) implements Node { +} diff --git a/src/main/java/de/maishai/ast/BoolConstant.java b/src/main/java/de/maishai/ast/BoolConstant.java new file mode 100644 index 0000000..274423d --- /dev/null +++ b/src/main/java/de/maishai/ast/BoolConstant.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; + +public record BoolConstant(Boolean value) implements Expression { +} diff --git a/src/main/java/de/maishai/ast/Break.java b/src/main/java/de/maishai/ast/Break.java new file mode 100644 index 0000000..a42659d --- /dev/null +++ b/src/main/java/de/maishai/ast/Break.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Statement; + +public record Break() implements Statement { +} diff --git a/src/main/java/de/maishai/ast/Continue.java b/src/main/java/de/maishai/ast/Continue.java new file mode 100644 index 0000000..f70fbe1 --- /dev/null +++ b/src/main/java/de/maishai/ast/Continue.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Statement; + +public record Continue() implements Statement { +} diff --git a/src/main/java/de/maishai/ast/Function.java b/src/main/java/de/maishai/ast/Function.java new file mode 100644 index 0000000..d642b1d --- /dev/null +++ b/src/main/java/de/maishai/ast/Function.java @@ -0,0 +1,9 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Node; +import de.dhbw.horb.ast.Type; + +import java.util.List; + +public record Function(Type type, String name, List params, Block block) implements Node { +} diff --git a/src/main/java/de/maishai/ast/FunctionCall.java b/src/main/java/de/maishai/ast/FunctionCall.java new file mode 100644 index 0000000..3ca1065 --- /dev/null +++ b/src/main/java/de/maishai/ast/FunctionCall.java @@ -0,0 +1,9 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Statement; + +import java.util.List; + +public record FunctionCall(String name, List args) implements Expression, Statement { +} diff --git a/src/main/java/de/maishai/ast/IfElse.java b/src/main/java/de/maishai/ast/IfElse.java new file mode 100644 index 0000000..784a628 --- /dev/null +++ b/src/main/java/de/maishai/ast/IfElse.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Statement; + +public record IfElse(Expression cond, Block ifBlock, Block elseBlock) implements Statement { +} diff --git a/src/main/java/de/maishai/ast/IntConstant.java b/src/main/java/de/maishai/ast/IntConstant.java new file mode 100644 index 0000000..0a87ac0 --- /dev/null +++ b/src/main/java/de/maishai/ast/IntConstant.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; + +public record IntConstant(Integer value) implements Expression { +} diff --git a/src/main/java/de/maishai/ast/Location.java b/src/main/java/de/maishai/ast/Location.java new file mode 100644 index 0000000..4dfac2b --- /dev/null +++ b/src/main/java/de/maishai/ast/Location.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; + +public record Location(String name) implements Expression { +} diff --git a/src/main/java/de/maishai/ast/Program.java b/src/main/java/de/maishai/ast/Program.java new file mode 100644 index 0000000..77096db --- /dev/null +++ b/src/main/java/de/maishai/ast/Program.java @@ -0,0 +1,8 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Node; + +import java.util.List; + +public record Program(List variables, List methods) implements Node { +} diff --git a/src/main/java/de/maishai/ast/Return.java b/src/main/java/de/maishai/ast/Return.java new file mode 100644 index 0000000..73462a1 --- /dev/null +++ b/src/main/java/de/maishai/ast/Return.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Statement; + +public record Return(Expression ret) implements Statement { +} diff --git a/src/main/java/de/maishai/ast/ReturnVoid.java b/src/main/java/de/maishai/ast/ReturnVoid.java new file mode 100644 index 0000000..e6a4746 --- /dev/null +++ b/src/main/java/de/maishai/ast/ReturnVoid.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Statement; + +public record ReturnVoid() implements Statement { +} diff --git a/src/main/java/de/maishai/ast/Variable.java b/src/main/java/de/maishai/ast/Variable.java new file mode 100644 index 0000000..a48bd10 --- /dev/null +++ b/src/main/java/de/maishai/ast/Variable.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Node; +import de.dhbw.horb.ast.Type; + +public record Variable(String name, Type type) implements Node { +} diff --git a/src/main/java/de/maishai/ast/VoidFunctionCall.java b/src/main/java/de/maishai/ast/VoidFunctionCall.java new file mode 100644 index 0000000..b9b0cd5 --- /dev/null +++ b/src/main/java/de/maishai/ast/VoidFunctionCall.java @@ -0,0 +1,6 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Statement; + +public record VoidFunctionCall(FunctionCall expr) implements Statement { +} diff --git a/src/main/java/de/maishai/ast/While.java b/src/main/java/de/maishai/ast/While.java new file mode 100644 index 0000000..1ad7965 --- /dev/null +++ b/src/main/java/de/maishai/ast/While.java @@ -0,0 +1,7 @@ +package de.maishai.ast; + +import de.dhbw.horb.ast.Expression; +import de.dhbw.horb.ast.Statement; + +public record While(Expression cond, Block block) implements Statement { +}