Changed AST Tree
This commit is contained in:
parent
4acf4dfe24
commit
6b7fc09f8f
@ -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;
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
package ast;
|
|
||||||
|
|
||||||
public class MemberNode extends ASTNode{
|
|
||||||
}
|
|
@ -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);
|
||||||
}
|
}
|
@ -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;
|
6
src/main/java/ast/member/MemberNode.java
Normal file
6
src/main/java/ast/member/MemberNode.java
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package ast.member;
|
||||||
|
|
||||||
|
import ast.ASTNode;
|
||||||
|
|
||||||
|
public class MemberNode extends ASTNode {
|
||||||
|
}
|
@ -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;
|
@ -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;
|
@ -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;
|
@ -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 {
|
||||||
|
@ -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;
|
@ -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;
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user