NichtHaskell/Source/abstractSyntaxTree/Program.java

32 lines
984 B
Java
Raw Normal View History

2024-05-08 08:10:44 +00:00
package abstractSyntaxTree;
import TypeCheck.TypeCheckResult;
2024-05-08 10:48:56 +00:00
import abstractSyntaxTree.Class.FieldDecl;
2024-05-08 08:10:44 +00:00
import abstractSyntaxTree.Datatype.RefType;
2024-05-08 09:22:12 +00:00
import java.util.HashMap;
2024-05-08 08:10:44 +00:00
import java.util.List;
public class Program {
public List<RefType> classes;
2024-05-08 10:48:56 +00:00
public HashMap<String, HashMap<String, String>> typeContext; // (class, (type, identifier))
public HashMap<String, HashMap<String, HashMap<String, String>>> methodContext; // (class, (returntype, (identifier, parameter)))
2024-05-08 09:22:12 +00:00
2024-05-08 08:10:44 +00:00
public TypeCheckResult typeCheck() throws Exception{
2024-05-08 09:22:12 +00:00
for(RefType oneClass : classes){
2024-05-08 10:48:56 +00:00
HashMap<String, String> classVars = new HashMap<>();
for (FieldDecl fielsDecl: oneClass.fieldDecls)
classVars.put(fielsDecl.type, fielsDecl.identifier);
2024-05-08 09:22:12 +00:00
oneClass.typeCheck();
}
2024-05-08 08:10:44 +00:00
return null;
}
2024-05-08 09:22:12 +00:00
public void codeGen() throws Exception{
for(RefType oneClass : classes){
oneClass.codeGen();
}
}
2024-05-08 08:10:44 +00:00
}