avancement sur Read et Print, todo : @.ftm

This commit is contained in:
Rochas
2025-04-13 16:00:06 +02:00
parent 2f16120dae
commit 9ef84876f7
4 changed files with 55 additions and 15 deletions

View File

@@ -57,7 +57,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
public DefineLLVM visitFunction(FunctionImp fun, SymTable h) {
ArrayList<InstructionLLVM> instrLLVM = new ArrayList<>();
instrLLVM.addAll(fun.instruction().accept(this, h));
return new DefineLLVMImpl(fun.nom(), fun.type().accept(this, h), instrLLVM);
return new DefineLLVMImpl(fun.nom(), fun.type().accept(this, h), new ArrayList<>(), instrLLVM);
}
//DECLARATION
@@ -130,7 +130,8 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
@Override
public ArrayList<InstructionLLVM> visitPrint(PrintImp instr, SymTable h) {
ArrayList<InstructionLLVM> l = new ArrayList<>();
l.add(new PrintLLVMImpl(new ArrayList())); //TODO
ArrayList<ValLLVM> params = new ArrayList<>();
l.add(new PrintLLVMImpl(params)); //TODO
return l;
}
@@ -141,7 +142,9 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
String nomVar = h.getVar(instr.t().get(i).name());
Type typeVar = h.getType(instr.t().get(i).name());
VarLLVMImpl newVar = new VarLLVMImpl(typeVar.accept(this,h), nomVar);
l.add(new ReadLLVMImpl(newVar));
ArrayList<ValLLVM> params = new ArrayList<>();
params.add(newVar);
l.add(new ReadLLVMImpl(params));
}
return l;
}