From 33df2c1c0a962b4e6bcffe4dde0a10b6d652b4e5 Mon Sep 17 00:00:00 2001 From: Bruder John Date: Tue, 14 May 2024 12:53:40 +0200 Subject: [PATCH] Fixed errors --- src/main/java/ast/LiteralNode.java | 8 +++++++- .../java/ast/expression/BinaryExpressionNode.java | 10 +++++++++- .../java/ast/expression/IdentifierExpressionNode.java | 11 ++++++++++- src/main/java/ast/expression/UnaryExpressionNode.java | 10 +++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/main/java/ast/LiteralNode.java b/src/main/java/ast/LiteralNode.java index 8fa060a..3873465 100644 --- a/src/main/java/ast/LiteralNode.java +++ b/src/main/java/ast/LiteralNode.java @@ -1,8 +1,10 @@ package ast; import ast.expression.ExpressionNode; +import semantic.SemanticVisitor; +import typechecker.TypeCheckResult; -public class LiteralNode extends ExpressionNode { +public class LiteralNode implements ExpressionNode { int value; private String type; @@ -20,4 +22,8 @@ public class LiteralNode extends ExpressionNode { } + @Override + public TypeCheckResult accept(SemanticVisitor visitor) { + return null; + } } diff --git a/src/main/java/ast/expression/BinaryExpressionNode.java b/src/main/java/ast/expression/BinaryExpressionNode.java index e63bbca..9260d3b 100644 --- a/src/main/java/ast/expression/BinaryExpressionNode.java +++ b/src/main/java/ast/expression/BinaryExpressionNode.java @@ -1,6 +1,9 @@ package ast.expression; -public class BinaryExpressionNode extends ExpressionNode { +import semantic.SemanticVisitor; +import typechecker.TypeCheckResult; + +public class BinaryExpressionNode implements ExpressionNode { public ExpressionNode left; public ExpressionNode right; public String operator; // Stores the operator as a string (e.g., "+", "-", "&&") @@ -10,4 +13,9 @@ public class BinaryExpressionNode extends ExpressionNode { this.right = right; this.operator = operator; } + + @Override + public TypeCheckResult accept(SemanticVisitor visitor) { + return null; + } } \ No newline at end of file diff --git a/src/main/java/ast/expression/IdentifierExpressionNode.java b/src/main/java/ast/expression/IdentifierExpressionNode.java index 7631429..0ad57d0 100644 --- a/src/main/java/ast/expression/IdentifierExpressionNode.java +++ b/src/main/java/ast/expression/IdentifierExpressionNode.java @@ -1,9 +1,18 @@ package ast.expression; -public class IdentifierExpressionNode extends ExpressionNode { +import semantic.SemanticVisitor; +import typechecker.TypeCheckResult; +import typechecker.Visitable; + +public class IdentifierExpressionNode implements ExpressionNode { public String name; public IdentifierExpressionNode(String name) { this.name = name; } + + @Override + public TypeCheckResult accept(SemanticVisitor visitor) { + return null; + } } diff --git a/src/main/java/ast/expression/UnaryExpressionNode.java b/src/main/java/ast/expression/UnaryExpressionNode.java index 0c77ef5..2c93670 100644 --- a/src/main/java/ast/expression/UnaryExpressionNode.java +++ b/src/main/java/ast/expression/UnaryExpressionNode.java @@ -1,6 +1,9 @@ package ast.expression; -public class UnaryExpressionNode extends ExpressionNode { +import semantic.SemanticVisitor; +import typechecker.TypeCheckResult; + +public class UnaryExpressionNode implements ExpressionNode { public ExpressionNode expression; public String operator; // Stores the operator (e.g., "-", "!") @@ -8,4 +11,9 @@ public class UnaryExpressionNode extends ExpressionNode { this.expression = expression; this.operator = operator; } + + @Override + public TypeCheckResult accept(SemanticVisitor visitor) { + return null; + } }