while imp en cours, todo : if else then

This commit is contained in:
trochas
2025-04-10 13:07:52 +02:00
8 changed files with 53 additions and 34 deletions

View File

@@ -103,9 +103,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent + "IF ";
str +=(instr.e().accept(this, ""));
str +=" THEN ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
return str;
}
@@ -114,13 +112,9 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent + "IF ";
str +=(instr.e().accept(this, ""));
str +=" THEN ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
str +=" ELSE ";
for(int i=0; i<instr.i2().size();i++){
str+= instr.i2().get(i).accept(this, "");
}
str+= instr.i2().accept(this, "");
return str;
}
@@ -139,9 +133,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent+"WHILE ";
str += (instr.e().accept(this, ""));
str+= " DO ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
str+= " DONE";
return str;
}