correction

This commit is contained in:
trochas
2025-04-28 14:55:34 +02:00
parent d9a2c0a4dd
commit 1b5dd97226
2 changed files with 7 additions and 6 deletions

View File

@@ -111,20 +111,20 @@ public class SymTable {
public Result addNewTempVar(){
String newVar = "temp"+id;
SymTable newSymTab = this.addVar(newVar,new Type_intImp(),false);
SymTable newSymTab = this.addVarInTab(newVar,new Type_intImp(),false);
return new Result(newSymTab,newVar);
}
public Result addParam(String nomParam){
String newParam = "param_"+nomParam+id;
SymTable newSymTab = this.addVar(nomParam,new Type_intImp(),true);
SymTable newSymTab = this.addVarInTab(nomParam,new Type_intImp(),true);
return new Result(newSymTab,newParam);
}
public Result addVar(String nomVar) {
PMap<String, ValueVarMap> top = varMap.get(0);
if (top.containsKey(nomVar)) {
System.err.println("Erreur");
System.err.println("[VSL compile error] :" + "Erreur");
return new Result(this, null);
}
String realName = nomVar + id;
@@ -145,7 +145,7 @@ public class SymTable {
return prefix + nomVar + value.id;
}
}
System.err.println(nomVar+" n'est pas trovué");
System.err.println("[VSL compile error] :" + nomVar+" n'est pas trovué");
return null;
}
@@ -155,7 +155,7 @@ public class SymTable {
return true;
}
}
System.err.println(nomVar+" n'est pas trouvé");
System.err.println("[VSL compile error] :" + nomVar+" n'est pas trouvé");
return false;
}
@@ -180,7 +180,7 @@ public class SymTable {
public SymTable addVar(String nomVar, Interface.Type type, boolean isParam) {
public SymTable addVarInTab(String nomVar, Interface.Type type, boolean isParam) {
PMap<String,ValueVarMap> top = varMap.get(0);
if (top.containsKey(nomVar)) {
System.err.println(nomVar+ " déjà déclaré.");

View File

@@ -271,6 +271,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
l.add(new BrLLVMImp(labelFin));
l.add(new LabelLLVMImp(labelFin));
prevSymTable.updateId(h);
return l;
}