NichtHaskell/Source/abstractSyntaxTree/Program.java
2024-05-08 14:15:11 +02:00

40 lines
1.3 KiB
Java

package abstractSyntaxTree;
import TypeCheck.TypeCheckResult;
import abstractSyntaxTree.Class.FieldDecl;
import abstractSyntaxTree.Class.RefType;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import java.util.HashMap;
import java.util.List;
public class Program {
public List<RefType> classes;
public HashMap<String, HashMap<String, String>> typeContext; // (class, (type, identifier))
public HashMap<String, HashMap<String, HashMap<String, String>>> methodContext; // (class, (returntype, (identifier, parameter)))
public TypeCheckResult typeCheck() throws Exception{
for(RefType oneClass : classes){
HashMap<String, String> classVars = new HashMap<>();
for (FieldDecl fielsDecl: oneClass.fieldDecls)
classVars.put(fielsDecl.type, fielsDecl.identifier);
oneClass.typeCheck();
}
return null;
}
public void codeGen() throws Exception{
for(RefType oneClass : classes){
//Get the name of the class
typeContext.get()
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC,
);
oneClass.codeGen(ClassWriter cw);
}
}
}