petit readme

This commit is contained in:
Rochas
2025-04-30 18:52:33 +02:00
parent d6301bad2d
commit 18beb717b2
41 changed files with 28 additions and 14 deletions

View File

@@ -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'");
}
}
}
*/
}*/

View File

@@ -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) {

View File

@@ -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());