if
This commit is contained in:
@@ -143,8 +143,20 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitIfThen(IfThenImp instr, SymTable h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitIfThen'");
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
String labelIf= "if"+h.getNewIdLabel();
|
||||
String labelThen= "then"+h.getNewIdLabel();
|
||||
String labelEnd= "end"+h.getNewIdLabel();
|
||||
|
||||
l.add(new LabelLLVMImp(labelIf));
|
||||
//TODO
|
||||
|
||||
//Je t'attends Tibo
|
||||
l.add(new LabelLLVMImp(labelThen));
|
||||
//TODO
|
||||
|
||||
l.add(new LabelLLVMImp(labelEnd));
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,8 +169,8 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
public ArrayList<InstructionLLVM> visitWhile(WhileImp instr, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
|
||||
String labelWhile = "while"+h.getNewIdLabel();
|
||||
String labelDo = "do"+h.getNewIdLabel();
|
||||
String labelWhile = "while"+h.getNewIdLabel()+":";
|
||||
String labelDo = "do"+h.getNewIdLabel()+":";
|
||||
String labelDone = "done"+h.getNewIdLabel();
|
||||
|
||||
l.add(new LabelLLVMImp(labelWhile));
|
||||
|
||||
@@ -151,4 +151,9 @@ TypeLLVMVisitor<String,String>
|
||||
public String visitVoidLLVM(VoidLLVMImpl e, String h) {
|
||||
return "void";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitLabelLLVM(LabelLLVMImp instr, String h) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user