modification de l'implémentation de prototype, il implement Function
This commit is contained in:
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user