correction bug expression de toLLVM, tout les test fragment0 marchent

This commit is contained in:
Rochas
2025-04-05 23:33:38 +02:00
parent 5e36f25197
commit c9f1f86a2c
6 changed files with 114 additions and 48 deletions

View File

@@ -4,14 +4,23 @@ import java.util.Stack;
import org.pcollections.*;
import TP2.asd.Interface.Type;
import TP2.asd.Program.Type_intImp;
public class SymTable {
private Stack<PMap<String,Type>> stackMap;
private int id=1;
public SymTable(){
this.stackMap= new Stack<>();
}
public String addNewTempVar(/*Type type*/){
//TODO
String newVar = "temp"+this.id;
//this.addVar(newVar,new Type_intImp()); //TODO
id++;
return newVar;
}
public void next_layer(){
stackMap.push(HashTreePMap.empty());
}
@@ -29,7 +38,8 @@ public class SymTable {
public void addVar(String s, Type t){
//Save temporary if not PMap wont save
PMap<String, Type> pmap = this.peppapeek();
pmap= pmap.plus(s,t);
pmap= pmap.plus(s/*+"_"+this.id*/,t);
//this.id++;
//Delete old ones
stackMap.pop();
//Push the new one
@@ -38,6 +48,7 @@ public class SymTable {
//Usually look for var in highest level , if not found research.
public boolean searchVar(String s){
//TOTO
for(int i= stackMap.size()-1; i>=0; i--){
if(stackMap.get(i).containsKey(s)){
return true;