scanf bon
This commit is contained in:
@@ -220,7 +220,12 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
|||||||
for(int i = 0; i<instr.t().size(); i++){
|
for(int i = 0; i<instr.t().size(); i++){
|
||||||
String nomVar = h.getVar(instr.t().get(i).name());
|
String nomVar = h.getVar(instr.t().get(i).name());
|
||||||
Type typeVar = h.getType(instr.t().get(i).name());
|
Type typeVar = h.getType(instr.t().get(i).name());
|
||||||
VarLLVMImp newVar = new VarLLVMImp(typeVar.accept(this,h), nomVar,false);
|
|
||||||
|
//Ajout * par passant PointerType
|
||||||
|
TypeLLVM baseType = typeVar.accept(this, h);
|
||||||
|
TypeLLVM ptrType = new PointerLLVMImp(baseType);
|
||||||
|
|
||||||
|
VarLLVMImp newVar = new VarLLVMImp(ptrType, nomVar,false);
|
||||||
strGlobal+="%d"; //2 char de long
|
strGlobal+="%d"; //2 char de long
|
||||||
size+=2;
|
size+=2;
|
||||||
params.add(newVar);
|
params.add(newVar);
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public interface Interface {
|
|||||||
public S visitVoidLLVM(VoidLLVMImp e, H h);
|
public S visitVoidLLVM(VoidLLVMImp e, H h);
|
||||||
public S visitBooleanLLVM(BooleanLLVMImp e, H h);
|
public S visitBooleanLLVM(BooleanLLVMImp e, H h);
|
||||||
public S visitCharLLVM(CharLLVMImp e, H h);
|
public S visitCharLLVM(CharLLVMImp e, H h);
|
||||||
|
public S visitPointerLLVM(PointerLLVMImp e,H h);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,6 +215,8 @@ TypeLLVMVisitor<String,String>
|
|||||||
else return "i8";
|
else return "i8";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String visitPointerLLVM(PointerLLVMImp e, String h) {
|
||||||
|
return e.type().accept(this, h) + "*";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,4 +224,10 @@ public class ProgramLLVM {
|
|||||||
return v.visitCharLLVM(this, h);
|
return v.visitCharLLVM(this, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static record PointerLLVMImp(TypeLLVM type) implements TypeLLVM{
|
||||||
|
public <H, S> S accept(TypeLLVMVisitor<H, S> v, H h) {
|
||||||
|
return v.visitPointerLLVM(this, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
tests/fragment1/read0
Executable file
BIN
tests/fragment1/read0
Executable file
Binary file not shown.
BIN
tests/fragment1/read1
Executable file
BIN
tests/fragment1/read1
Executable file
Binary file not shown.
BIN
tests/fragment1/read2
Executable file
BIN
tests/fragment1/read2
Executable file
Binary file not shown.
BIN
tests/testsAdvanced/portee
Executable file
BIN
tests/testsAdvanced/portee
Executable file
Binary file not shown.
Reference in New Issue
Block a user