This commit is contained in:
Vu Tuan Minh
2025-04-28 14:37:25 +02:00
parent a421811002
commit 6778440827
3 changed files with 11 additions and 4 deletions

View File

@@ -124,10 +124,16 @@ instruction returns [Instruction out]:
}
) BacF
| //ASSIGN
i=ident ASSIGN e=expression
{
i=ident
(ASSIGN e=expression
{
$out = new AssignImp($i.out, $e.out);
}
}
|ParO (para=list_expression)? ParF
{
$out = new VoidFunctionImp($i.out,($para.out != null) ? $para.out : new ArrayList<>());
}
)
| // PRINT
PRINT
{ArrayList<Object> printer= new ArrayList<Object>();}

View File

@@ -157,7 +157,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
@Override
public String visitVoidFunction(VoidFunctionImp instr, String h) {
String str = instr.nom()+ "( ";
String str = h+instr.nom()+ "(";
for(int i=0;i<instr.expr().size();i++){
str+= instr.expr().get(i).accept(this,h);
if(i<instr.expr().size()-1){

View File

@@ -203,6 +203,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
if (!(fun.define.type() instanceof VoidLLVMImp)){
System.err.println("Fonction n'est pas un void");
return l;
}
l.add(new CallLLVMImp(fun.define,paramsLLVM,""));