correction nom variable
This commit is contained in:
@@ -26,6 +26,8 @@ java -jar build/libs/TP2.jar tests/aLaMain.vsl
|
||||
frament 1 :
|
||||
java -jar build/libs/TP2.jar tests/fragment1/print4.vsl
|
||||
|
||||
java -jar build/libs/TP2.jar tests/fragment1/while2.vsl > tests/fragment1/while2.ll
|
||||
clang tests/fragment1/while2.ll -o tests/fragment1/while2
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public class SymTable {
|
||||
System.err.println("[VSL compile error] : '" + nomVar+ "' Erreur");
|
||||
return new Result(this, null);
|
||||
}
|
||||
String realName = nomVar + id[0];
|
||||
String realName = nomVar + "_" + id[0];
|
||||
top = top.plus(nomVar, new ValueVarMap(type, id[0], false));
|
||||
id[0]++;
|
||||
SymTable newSym = new SymTable(varMap.minus(0).plus(0, top), functionsMap, id,this.declarationsGlobal);
|
||||
@@ -161,7 +161,7 @@ public class SymTable {
|
||||
if (scope.containsKey(nomVar)) {
|
||||
ValueVarMap value = scope.get(nomVar);
|
||||
String prefix = "";
|
||||
String id = ""+value.id;
|
||||
String id = "_"+value.id;
|
||||
if(value.isParam){
|
||||
prefix = "param_";
|
||||
id ="";
|
||||
|
||||
@@ -340,7 +340,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
String labelWhile = "while"+h.getNewIdLabel();
|
||||
String labelDo = "do"+h.getNewIdLabel();
|
||||
String labelDone = "done"+h.getNewIdLabel();
|
||||
|
||||
l.add(new BrLLVMImp(labelWhile));
|
||||
l.add(new LabelLLVMImp(labelWhile));
|
||||
InstrAndVal temp = instr.e().accept(this,h); //retourne les instructionz pour obtenir le résultat de l'expression ainsi que la variable contenant le résultat final
|
||||
l.addAll(temp.instrs); //instructions
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user