modification de l'implémentation de prototype, il implement Function

This commit is contained in:
Rochas
2025-04-26 21:48:41 +02:00
parent 29ab19fd7a
commit a34802db55
10 changed files with 272 additions and 225 deletions

View File

@@ -3,10 +3,16 @@ import java.util.Stack;
import org.pcollections.*;
import TP2.asd.Interface.Type;
import TP2.asd.Program.Type_intImp;
import TP2.llvm.ProgramLLVM.DefineLLVMImpl;
public class SymTable {
private PStack<PMap<String,ValueTable>> stackMap;
private PMap<String,DefineLLVMImpl> fuctionsMap;
private int id=1;
private int idLabel = 1;
public static class ValueTable{
public Type type;
public int id;
@@ -27,17 +33,26 @@ public class SymTable {
}
}
private PStack<PMap<String,ValueTable>> stackMap;
private int id=1;
public int idLabel = 1;
public SymTable(){
this.stackMap= ConsPStack.empty();
this.stackMap= ConsPStack.empty(); //todo : HashTreePMap.empty() stack sers à rien
this.fuctionsMap = HashTreePMap.empty();
}
public SymTable(PStack<PMap<String,ValueTable>> stackMap, int id){
this.stackMap= stackMap;
this.id = id;
}
public void addFunction(DefineLLVMImpl function){
if(!this.fuctionsMap.containsKey(function.name())){
this.fuctionsMap.plus(function.name(),function);
}
}
public DefineLLVMImpl getFunction(String name){
return this.fuctionsMap.get(name);
}
public int getNewId(){
int a = this.id;
this.id++;