code-generator #8

Merged
i22007 merged 11 commits from code-generator into main 2024-05-14 13:34:52 +00:00
4 changed files with 35 additions and 4 deletions
Showing only changes of commit 91f7db24f6 - Show all commits

View File

@ -1,8 +1,10 @@
package ast; package ast;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
import semantic.SemanticVisitor;
import typechecker.TypeCheckResult;
public class LiteralNode extends ExpressionNode { public class LiteralNode implements ExpressionNode {
int value; int value;
private String type; private String type;
@ -20,4 +22,8 @@ public class LiteralNode extends ExpressionNode {
} }
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
} }

View File

@ -1,6 +1,9 @@
package ast.expression; package ast.expression;
public class BinaryExpressionNode extends ExpressionNode { import semantic.SemanticVisitor;
import typechecker.TypeCheckResult;
public class BinaryExpressionNode implements ExpressionNode {
public ExpressionNode left; public ExpressionNode left;
public ExpressionNode right; public ExpressionNode right;
public String operator; // Stores the operator as a string (e.g., "+", "-", "&&") public String operator; // Stores the operator as a string (e.g., "+", "-", "&&")
@ -10,4 +13,9 @@ public class BinaryExpressionNode extends ExpressionNode {
this.right = right; this.right = right;
this.operator = operator; this.operator = operator;
} }
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
} }

View File

@ -1,9 +1,18 @@
package ast.expression; 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 String name;
public IdentifierExpressionNode(String name) { public IdentifierExpressionNode(String name) {
this.name = name; this.name = name;
} }
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
} }

View File

@ -1,6 +1,9 @@
package ast.expression; package ast.expression;
public class UnaryExpressionNode extends ExpressionNode { import semantic.SemanticVisitor;
import typechecker.TypeCheckResult;
public class UnaryExpressionNode implements ExpressionNode {
public ExpressionNode expression; public ExpressionNode expression;
public String operator; // Stores the operator (e.g., "-", "!") public String operator; // Stores the operator (e.g., "-", "!")
@ -8,4 +11,9 @@ public class UnaryExpressionNode extends ExpressionNode {
this.expression = expression; this.expression = expression;
this.operator = operator; this.operator = operator;
} }
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
} }