block presque bon
This commit is contained in:
@@ -56,9 +56,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
@Override
|
||||
public DefineLLVM visitFunction(FunctionImp fun, SymTable h) {
|
||||
ArrayList<InstructionLLVM> instrLLVM = new ArrayList<>();
|
||||
for(int i = 0; i<fun.instructions().size(); i++){
|
||||
instrLLVM.addAll(fun.instructions().get(i).accept(this, h));
|
||||
}
|
||||
instrLLVM.addAll(fun.instruction().accept(this, h));
|
||||
return new DefineLLVMImpl(fun.nom(), fun.type().accept(this, h), instrLLVM);
|
||||
}
|
||||
|
||||
@@ -95,14 +93,25 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitBloc(BlocImp instr, SymTable h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBloc'");
|
||||
ArrayList<InstructionLLVM> instrLLVM = new ArrayList<>();
|
||||
for(int i = 0; i<instr.instrs().size(); i++){
|
||||
instrLLVM.addAll(instr.instrs().get(i).accept(this, h));
|
||||
}
|
||||
return instrLLVM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitBlocDec(BlocDecImp instr, SymTable h) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitBlocDec'");
|
||||
ArrayList<InstructionLLVM> instrLLVM = new ArrayList<>();
|
||||
for(int i = 0; i<instr.decls().size(); i++){
|
||||
InstrAndSymTable temp = instr.decls().get(i).accept(this, h);
|
||||
h = temp.symTable;
|
||||
instrLLVM.addAll(temp.instrs);
|
||||
}
|
||||
for(int i = 0; i<instr.instrs().size(); i++){
|
||||
instrLLVM.addAll(instr.instrs().get(i).accept(this, h));
|
||||
}
|
||||
return instrLLVM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,8 +33,8 @@ public interface Interface {
|
||||
public S visitPrintLLVM(PrintLLVMImpl instr, H h);
|
||||
public S visitReadLLVM(ReadLLVMImpl instr, H h);
|
||||
public S visitIfThenElseLLVM(IfThenElseImp instr, H h);
|
||||
public S visitIfThenLLVM(IfThenImp instr, H h);
|
||||
public S visitWhileLLVM(WhileImp instr, H h);
|
||||
//public S visitIfThenLLVM(IfThenImp instr, H h); TODO
|
||||
//public S visitWhileLLVM(WhileImp instr, H h);
|
||||
}
|
||||
|
||||
//////////ExpressionLLVM (expression)
|
||||
|
||||
Reference in New Issue
Block a user