This commit is contained in:
trochas
2025-04-28 14:41:03 +02:00
3 changed files with 11 additions and 4 deletions

View File

@@ -124,10 +124,16 @@ instruction returns [Instruction out]:
} }
) BacF ) BacF
| //ASSIGN | //ASSIGN
i=ident ASSIGN e=expression i=ident
{ (ASSIGN e=expression
{
$out = new AssignImp($i.out, $e.out); $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
PRINT PRINT
{ArrayList<Object> printer= new ArrayList<Object>();} {ArrayList<Object> printer= new ArrayList<Object>();}

View File

@@ -157,7 +157,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
@Override @Override
public String visitVoidFunction(VoidFunctionImp instr, String h) { 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++){ for(int i=0;i<instr.expr().size();i++){
str+= instr.expr().get(i).accept(this,h); str+= instr.expr().get(i).accept(this,h);
if(i<instr.expr().size()-1){ 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)){ if (!(fun.define.type() instanceof VoidLLVMImp)){
System.err.println("Fonction n'est pas un void"); System.err.println("Fonction n'est pas un void");
return l;
} }
l.add(new CallVoidLLVMImp(fun.define,paramsLLVM,"")); l.add(new CallVoidLLVMImp(fun.define,paramsLLVM,""));