Changed AST Tree

This commit is contained in:
i22035 2024-05-09 13:55:45 +02:00
parent 4acf4dfe24
commit 6b7fc09f8f
15 changed files with 42 additions and 21 deletions

View File

@ -1,5 +1,7 @@
package ast; package ast;
import ast.member.ConstructorNode;
import ast.member.MemberNode;
import ast.type.AccessTypeNode; import ast.type.AccessTypeNode;
import ast.type.EnumAccessTypeNode; import ast.type.EnumAccessTypeNode;

View File

@ -1,4 +0,0 @@
package ast;
public class MemberNode extends ASTNode{
}

View File

@ -1,8 +1,8 @@
package ast; package ast.member;
import ast.type.AccessTypeNode; import ast.type.AccessTypeNode;
public class ConstructorNode extends MethodNode{ public class ConstructorNode extends MethodNode {
public ConstructorNode(AccessTypeNode visibility, String name) { public ConstructorNode(AccessTypeNode visibility, String name) {
super(visibility, name); super(visibility, name);
} }

View File

@ -1,6 +1,8 @@
package ast; package ast.member;
import ast.IdentifierNode;
import ast.type.AccessTypeNode; import ast.type.AccessTypeNode;
import ast.type.TypeNode;
public class FieldNode extends MemberNode { public class FieldNode extends MemberNode {
public AccessTypeNode accessTypeNode; public AccessTypeNode accessTypeNode;

View File

@ -0,0 +1,6 @@
package ast.member;
import ast.ASTNode;
public class MemberNode extends ASTNode {
}

View File

@ -1,12 +1,15 @@
package ast; package ast.member;
import ast.IdentifierNode;
import ast.parameter.ParameterListNode;
import ast.statement.StatementNode; import ast.statement.StatementNode;
import ast.type.AccessTypeNode; import ast.type.AccessTypeNode;
import ast.type.TypeNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MethodNode extends MemberNode{ public class MethodNode extends MemberNode {
public IdentifierNode identifier; public IdentifierNode identifier;
public AccessTypeNode visibility; public AccessTypeNode visibility;
public TypeNode type; public TypeNode type;

View File

@ -1,4 +1,6 @@
package ast; package ast.parameter;
import ast.ASTNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,7 @@
package ast; package ast.parameter;
import ast.ASTNode;
import ast.type.TypeNode;
public class ParameterNode extends ASTNode { public class ParameterNode extends ASTNode {
public TypeNode type; public TypeNode type;

View File

@ -1,6 +1,6 @@
package ast.statement; package ast.statement;
import ast.TypeNode; import ast.type.TypeNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
public class VariableDeclarationStatementNode extends StatementNode { public class VariableDeclarationStatementNode extends StatementNode {

View File

@ -1,6 +1,6 @@
package ast; package ast.type;
import ast.type.EnumTypeNode; import ast.ASTNode;
public class TypeNode extends ASTNode { public class TypeNode extends ASTNode {
public EnumTypeNode enumTypeNode; public EnumTypeNode enumTypeNode;

View File

@ -1,9 +1,9 @@
package bytecode; package bytecode;
import ast.ClassNode; import ast.ClassNode;
import ast.FieldNode; import ast.member.FieldNode;
import ast.MemberNode; import ast.member.MemberNode;
import ast.MethodNode; import ast.member.MethodNode;
import java.io.File; import java.io.File;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;

View File

@ -1,9 +1,8 @@
package bytecode; package bytecode;
import ast.FieldNode; import ast.member.FieldNode;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
public class FieldCodeGen { public class FieldCodeGen {

View File

@ -1,9 +1,8 @@
package bytecode; package bytecode;
import ast.MethodNode; import ast.member.MethodNode;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class MethodCodeGen { public class MethodCodeGen {
public void generateMethodCode(ClassWriter classWriter, MethodNode methodNode) { public void generateMethodCode(ClassWriter classWriter, MethodNode methodNode) {

View File

@ -5,10 +5,16 @@ import ast.expression.BinaryExpressionNode;
import ast.expression.ExpressionNode; import ast.expression.ExpressionNode;
import ast.expression.IdentifierExpressionNode; import ast.expression.IdentifierExpressionNode;
import ast.expression.UnaryExpressionNode; import ast.expression.UnaryExpressionNode;
import ast.member.FieldNode;
import ast.member.MemberNode;
import ast.member.MethodNode;
import ast.parameter.ParameterListNode;
import ast.parameter.ParameterNode;
import ast.statement.*; import ast.statement.*;
import ast.type.AccessTypeNode; import ast.type.AccessTypeNode;
import ast.type.EnumAccessTypeNode; import ast.type.EnumAccessTypeNode;
import ast.type.EnumTypeNode; import ast.type.EnumTypeNode;
import ast.type.TypeNode;
import org.antlr.v4.runtime.tree.TerminalNode; import org.antlr.v4.runtime.tree.TerminalNode;
import parser.generated.SimpleJavaBaseVisitor; import parser.generated.SimpleJavaBaseVisitor;
import parser.generated.SimpleJavaParser; import parser.generated.SimpleJavaParser;

View File

@ -2,6 +2,9 @@ package semantic;
import ast.*; import ast.*;
import ast.member.ConstructorNode;
import ast.member.FieldNode;
import ast.member.MemberNode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;