maj SymTable (id global) + DeclGlobal
This commit is contained in:
@@ -9,7 +9,7 @@ import TP2.llvm.Interface.*;
|
||||
public class ProgramLLVM {
|
||||
|
||||
//Program
|
||||
public static record ProgramLLVMImp(ArrayList<Integer> declration ,ArrayList<DefineLLVM> fonctions) implements ProgLLVM{
|
||||
public static record ProgramLLVMImp(ArrayList<DeclarGlobalLLVMImp> declarGlobal ,ArrayList<DefineLLVM> fonctions) implements ProgLLVM{
|
||||
public <H, S> S accept(ProgramLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitProgramLLVM(this, h);
|
||||
}
|
||||
@@ -81,14 +81,14 @@ public class ProgramLLVM {
|
||||
}
|
||||
}
|
||||
|
||||
public static record PrintLLVMImp(ArrayList<ValLLVM> l) implements InstructionLLVM{ //TODO c'est un Call qui appel la fonction print
|
||||
public static record PrintLLVMImp(DeclarGlobalLLVMImp fmt,ArrayList<ValLLVM> l) implements InstructionLLVM{
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitPrintLLVM(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record ReadLLVMImp(ArrayList<ValLLVM> l) implements InstructionLLVM{ //TODO c'est un Call qui appel la fonction read
|
||||
public static record ReadLLVMImp(DeclarGlobalLLVMImp fmt,ArrayList<ValLLVM> l) implements InstructionLLVM{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
@@ -96,6 +96,14 @@ public class ProgramLLVM {
|
||||
}
|
||||
}
|
||||
|
||||
public static record DeclarGlobalLLVMImp(String name) implements InstructionLLVM{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitDeclarGlobalLLVM(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
//Expression :
|
||||
public static record BinOpLLVMImp(TypeLLVM type,Op op, ValLLVM val1,ValLLVM val2) implements ExpressionLLVM{
|
||||
@Override
|
||||
@@ -170,13 +178,12 @@ public class ProgramLLVM {
|
||||
|
||||
@Override
|
||||
public TypeLLVM getType() {
|
||||
System.out.println("getType");
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static record VarLLVMImp(TypeLLVM type, String nom) implements ValLLVM{
|
||||
public static record VarLLVMImp(TypeLLVM type, String nom, Boolean isGlobal) implements ValLLVM{
|
||||
@Override
|
||||
public <H, S> S accept(ExpressionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitVarLLVM(this, h);
|
||||
@@ -184,7 +191,6 @@ public class ProgramLLVM {
|
||||
|
||||
@Override
|
||||
public TypeLLVM getType() {
|
||||
System.out.println("getType");
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user