diff --git a/README.md b/README.md index 5153d64..6b5de33 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,9 @@ Type ::= INT | VOID ## Etat +Nous sommes arrivés jusqu'au segment 2, nous avons commencé le segment 3 mais celui-ci ne marche pas encore complètement +Au niveau de la détection de type, nous l'avons directement intégré à l'intérieur du visitor toLLVM au lieu de le faire dans un bloc séparé, par manque de temps. + ## Compatibilité Pour construire le compilateur : diff --git a/src/main/java/TP2/Error/TypeChecking.java b/src/main/java/TP2/Error/TypeChecking.java index d169e75..a7706a6 100644 --- a/src/main/java/TP2/Error/TypeChecking.java +++ b/src/main/java/TP2/Error/TypeChecking.java @@ -1,3 +1,4 @@ +//TypeChecking implémenté à l'intèrieur de toLLVM... /*package TP2.Error; import TP2.asd.SymTable; @@ -158,10 +159,9 @@ public class TypeChecking { } @Override - public TypeCheckExprDiag visitAppeal(AppealImp instr, SymTable h) { + public TypeCheckExprDiag visitCall(CallImp instr, SymTable h) { // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'visitAppeal'"); + throw new UnsupportedOperationException("Unimplemented method 'visitCall'"); } } -} -*/ \ No newline at end of file +}*/ diff --git a/src/main/java/TP2/Main.java b/src/main/java/TP2/Main.java index 701f93b..27b8478 100644 --- a/src/main/java/TP2/Main.java +++ b/src/main/java/TP2/Main.java @@ -30,14 +30,15 @@ java -jar build/libs/TP2.jar tests/fragment0/priority2.vsl java -jar build/libs/TP2.jar tests/aLaMain.vsl -(/!\ pas besoin, le main le fait tout seul /!\) java -jar build/libs/TP2.jar tests/fragment1/while2.vsl > tests/fragment1/while2.ll +(pas besoin, pour les test à la main) java -jar build/libs/TP2.jar tests/fragment1/while2.vsl > tests/fragment1/while2.ll clang tests/aLaMain.ll -o tests/aLaMain */ public class Main { - static Boolean TESTAUTOMOD = false; + static Boolean TESTAUTOMOD = true; //pour les tests python mettre à true + static Boolean AFFICHAGE = true; public static void main(String[] args) { try { // Set input @@ -62,19 +63,22 @@ public class Main { // Pretty-print the program (to debug parsing) - if(!TESTAUTOMOD) System.out.println("\nVSL:\n"); + if(!TESTAUTOMOD && AFFICHAGE) System.out.println("\nVSL:\n"); - if(!TESTAUTOMOD) System.out.println(ast.prettyprinter()); + if(!TESTAUTOMOD && AFFICHAGE) System.out.println(ast.prettyprinter()); // Verify the program semantic + //Par manque de temps la vérification sémantique se fait uniquement dans toLLVM // Generate the intermediate representation - if(!TESTAUTOMOD) System.out.println("\nLLVM:\n"); + if(!TESTAUTOMOD && AFFICHAGE) System.out.println("\nLLVM:\n"); ProgramLLVMImp astLLVM = ast.toLLVM(); String llvmStr = astLLVM.prettyprinter(); - System.out.println(llvmStr); + if(TESTAUTOMOD || AFFICHAGE){ + System.out.println(llvmStr); + } /* utiliser la commande : @@ -89,9 +93,11 @@ public class Main { llvmStr.getBytes(StandardCharsets.UTF_8) ); - System.out.println("\n[VSL compile succes] : " + args[0] + " -> " + sortieLLVM); - System.out.println("Pour compiler en bin utilisez :"); - System.out.println("clang " + sortieLLVM + " -o " + sortieLLVM.replace(".ll", "") + "\n"); + if(AFFICHAGE){ + System.out.println("\n[VSL compile succes] : " + args[0] + " -> " + sortieLLVM); + System.out.println("Pour compiler en bin utilisez :"); + System.out.println("clang " + sortieLLVM + " -o " + sortieLLVM.replace(".ll", "") + "\n"); + } } } catch (IOException | RecognitionException e) { diff --git a/src/main/java/TP2/asd/Program.java b/src/main/java/TP2/asd/Program.java index df38e65..4b9516d 100644 --- a/src/main/java/TP2/asd/Program.java +++ b/src/main/java/TP2/asd/Program.java @@ -1,6 +1,7 @@ package TP2.asd; import java.util.ArrayList; + import TP2.asd.Interface.*; import TP2.llvm.ProgramLLVM.*; @@ -17,7 +18,11 @@ public class Program{ return this.accept(ppVisitor, ""); } - @Override + //public TypeCheckExprDiag typeChecking(){ + // TypeChecking tcVisitor = new TypeChecking(); + // return this.accept(tcVisitor, new SymTable()); + //} + public ProgramLLVMImp toLLVM() { toLLVM_Visitor llvmVisitor = new toLLVM_Visitor(); return this.accept(llvmVisitor,new SymTable()); diff --git a/tests/fragment0/add0 b/tests/fragment0/add0 index 1fe9149..eb8aeb0 100755 Binary files a/tests/fragment0/add0 and b/tests/fragment0/add0 differ diff --git a/tests/fragment0/add1 b/tests/fragment0/add1 index dd9dce2..6519c6a 100755 Binary files a/tests/fragment0/add1 and b/tests/fragment0/add1 differ diff --git a/tests/fragment0/const0 b/tests/fragment0/const0 index cc66346..0dfcb5d 100755 Binary files a/tests/fragment0/const0 and b/tests/fragment0/const0 differ diff --git a/tests/fragment0/const1 b/tests/fragment0/const1 index 169f011..48a422d 100755 Binary files a/tests/fragment0/const1 and b/tests/fragment0/const1 differ diff --git a/tests/fragment0/div0 b/tests/fragment0/div0 index 586b468..99b2163 100755 Binary files a/tests/fragment0/div0 and b/tests/fragment0/div0 differ diff --git a/tests/fragment0/div1 b/tests/fragment0/div1 index ade379c..d561525 100755 Binary files a/tests/fragment0/div1 and b/tests/fragment0/div1 differ diff --git a/tests/fragment0/mod b/tests/fragment0/mod index f00d181..49fa510 100755 Binary files a/tests/fragment0/mod and b/tests/fragment0/mod differ diff --git a/tests/fragment0/mult1 b/tests/fragment0/mult1 index afe05f6..74f33a8 100755 Binary files a/tests/fragment0/mult1 and b/tests/fragment0/mult1 differ diff --git a/tests/fragment0/mult2 b/tests/fragment0/mult2 index 53e1a1c..1794296 100755 Binary files a/tests/fragment0/mult2 and b/tests/fragment0/mult2 differ diff --git a/tests/fragment0/paren b/tests/fragment0/paren index 64fd9c7..b962551 100755 Binary files a/tests/fragment0/paren and b/tests/fragment0/paren differ diff --git a/tests/fragment0/priority1 b/tests/fragment0/priority1 index f12f1cb..ada72c3 100755 Binary files a/tests/fragment0/priority1 and b/tests/fragment0/priority1 differ diff --git a/tests/fragment0/priority2 b/tests/fragment0/priority2 index 6d9debd..99341f4 100755 Binary files a/tests/fragment0/priority2 and b/tests/fragment0/priority2 differ diff --git a/tests/fragment0/sub0 b/tests/fragment0/sub0 index f5d2d22..bade3c4 100755 Binary files a/tests/fragment0/sub0 and b/tests/fragment0/sub0 differ diff --git a/tests/fragment0/sub1 b/tests/fragment0/sub1 index 2774b98..47c80ed 100755 Binary files a/tests/fragment0/sub1 and b/tests/fragment0/sub1 differ diff --git a/tests/fragment1/assign1 b/tests/fragment1/assign1 index d200d19..cf9efb2 100755 Binary files a/tests/fragment1/assign1 and b/tests/fragment1/assign1 differ diff --git a/tests/fragment1/assign2 b/tests/fragment1/assign2 index 38bc634..37e59ef 100755 Binary files a/tests/fragment1/assign2 and b/tests/fragment1/assign2 differ diff --git a/tests/fragment1/block b/tests/fragment1/block index 6bf7478..523e0dc 100755 Binary files a/tests/fragment1/block and b/tests/fragment1/block differ diff --git a/tests/fragment1/decl b/tests/fragment1/decl index 60a0cb6..caf9e38 100755 Binary files a/tests/fragment1/decl and b/tests/fragment1/decl differ diff --git a/tests/fragment1/hello_world b/tests/fragment1/hello_world index 188e33b..94b3d93 100755 Binary files a/tests/fragment1/hello_world and b/tests/fragment1/hello_world differ diff --git a/tests/fragment1/if1 b/tests/fragment1/if1 index 8b0242b..8363a41 100755 Binary files a/tests/fragment1/if1 and b/tests/fragment1/if1 differ diff --git a/tests/fragment1/if2 b/tests/fragment1/if2 index 1a50677..8363a41 100755 Binary files a/tests/fragment1/if2 and b/tests/fragment1/if2 differ diff --git a/tests/fragment1/print1 b/tests/fragment1/print1 index 785d70c..7e9d42b 100755 Binary files a/tests/fragment1/print1 and b/tests/fragment1/print1 differ diff --git a/tests/fragment1/print2 b/tests/fragment1/print2 index 41730f4..4380479 100755 Binary files a/tests/fragment1/print2 and b/tests/fragment1/print2 differ diff --git a/tests/fragment1/print3 b/tests/fragment1/print3 index 154cbb1..660bdb2 100755 Binary files a/tests/fragment1/print3 and b/tests/fragment1/print3 differ diff --git a/tests/fragment1/print4 b/tests/fragment1/print4 index 8faade0..352a1ef 100755 Binary files a/tests/fragment1/print4 and b/tests/fragment1/print4 differ diff --git a/tests/fragment1/sequence b/tests/fragment1/sequence index 5c8c446..ae98c96 100755 Binary files a/tests/fragment1/sequence and b/tests/fragment1/sequence differ diff --git a/tests/fragment1/while1 b/tests/fragment1/while1 index 0c0c862..ba23d15 100755 Binary files a/tests/fragment1/while1 and b/tests/fragment1/while1 differ diff --git a/tests/fragment1/while2 b/tests/fragment1/while2 index 3bb9329..e938c02 100755 Binary files a/tests/fragment1/while2 and b/tests/fragment1/while2 differ diff --git a/tests/fragment2/call b/tests/fragment2/call index 8a2f61f..7818f00 100755 Binary files a/tests/fragment2/call and b/tests/fragment2/call differ diff --git a/tests/fragment2/call2 b/tests/fragment2/call2 index 38e42ae..dd282e6 100755 Binary files a/tests/fragment2/call2 and b/tests/fragment2/call2 differ diff --git a/tests/fragment2/call3expr b/tests/fragment2/call3expr index 55ae6e5..062242a 100755 Binary files a/tests/fragment2/call3expr and b/tests/fragment2/call3expr differ diff --git a/tests/fragment2/call4if b/tests/fragment2/call4if index 351a31b..a221f21 100755 Binary files a/tests/fragment2/call4if and b/tests/fragment2/call4if differ diff --git a/tests/fragment2/proto1 b/tests/fragment2/proto1 index 3cc91b4..ec47f60 100755 Binary files a/tests/fragment2/proto1 and b/tests/fragment2/proto1 differ diff --git a/tests/fragment2/proto2 b/tests/fragment2/proto2 index f50137f..001c741 100755 Binary files a/tests/fragment2/proto2 and b/tests/fragment2/proto2 differ diff --git a/tests/testsAdvanced/carre b/tests/testsAdvanced/carre index 9d86135..aa4879d 100755 Binary files a/tests/testsAdvanced/carre and b/tests/testsAdvanced/carre differ diff --git a/tests/testsAdvanced/diverge b/tests/testsAdvanced/diverge index 21bedf3..82645a9 100755 Binary files a/tests/testsAdvanced/diverge and b/tests/testsAdvanced/diverge differ diff --git a/tests/testsAdvanced/divergeDifficile b/tests/testsAdvanced/divergeDifficile index 38bbea8..5120fb8 100755 Binary files a/tests/testsAdvanced/divergeDifficile and b/tests/testsAdvanced/divergeDifficile differ