symTable marche un peut mieux (je crois)
This commit is contained in:
@@ -78,7 +78,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
|
||||
public String visitRead(ReadImp instr, String indent) {
|
||||
String str = indent+"READ ";
|
||||
for(int i = 0; i<instr.t().size(); i++){
|
||||
str += instr.t().get(i);//.accept(this,h);
|
||||
str += instr.t().get(i).accept(this,indent);
|
||||
if(i<instr.t().size()-1) str += ", ";
|
||||
}
|
||||
return str;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SymTable {
|
||||
|
||||
public Result addNewTempVar(/*Type type*/){
|
||||
//TODO
|
||||
String newVar = "temp"+getNewId();
|
||||
String newVar = "temp"+id;
|
||||
SymTable newSymTab = this.addVar(newVar,new Type_intImp()); //TODO
|
||||
return new Result(newSymTab,newVar);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class SymTable {
|
||||
pmap= pmap.plus(s/*+"_"+this.id*/,new ValueTable(t, getNewId()));
|
||||
//this.id++;
|
||||
//Delete old ones
|
||||
newpstack = newpstack.minus(stackMap.indexOf(stackMap.getLast()));
|
||||
newpstack = newpstack.minus(newpstack.indexOf(newpstack.getLast()));
|
||||
//Push the new one
|
||||
newpstack = newpstack.plus(pmap);
|
||||
return new SymTable(newpstack,this.id);
|
||||
|
||||
Reference in New Issue
Block a user