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