Merge branch 'main' of https://gitlab2.istic.univ-rennes1.fr/tuvu/tp2-vsl-pds
This commit is contained in:
@@ -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>();}
|
||||||
|
|||||||
@@ -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){
|
||||||
|
|||||||
@@ -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,""));
|
||||||
|
|||||||
Reference in New Issue
Block a user