todo toLLVM

This commit is contained in:
trochas
2025-04-04 18:18:12 +02:00
parent 651bd9f7bb
commit 59ba13fe18
3 changed files with 16 additions and 3 deletions

View File

@@ -47,16 +47,16 @@ public class Main {
// Pretty-print the program (to debug parsing) // Pretty-print the program (to debug parsing)
System.err.println("todo " + ast); System.err.println("todo " + ast);
//System.out.println("\n\n PRETTYPRINTER : \n--------------\n" + ast.prettyprinter() + "\n--------------\nFIN PRETTYPRINTER"); System.out.println("\n\n PRETTYPRINTER : \n--------------\n" + ast.prettyprinter() + "\n--------------\nFIN PRETTYPRINTER");
// Verify the program semantic // Verify the program semantic
// Generate the intermediate representation // Generate the intermediate representation
System.out.println("todo"); System.out.println("todo");
ProgramLLVMImpl astLLVM = ast.toLLVM(); //ProgramLLVMImpl astLLVM = ast.toLLVM();
System.out.println("\n\n PRETTYPRINTER : \n--------------\n" + astLLVM.prettyprinter() + "\n--------------\nFIN PRETTYPRINTER"); //System.out.println("\n\n PRETTYPRINTER : \n--------------\n" + astLLVM.prettyprinter() + "\n--------------\nFIN PRETTYPRINTER");

View File

@@ -45,6 +45,7 @@ public interface Interface{
public interface Expression { public interface Expression {
public <H,S> S accept(ExprVisitor<H,S> v, H h); public <H,S> S accept(ExprVisitor<H,S> v, H h);
public String prettyprinter(); public String prettyprinter();
public DefineLLVM toLLVM();
} }
public interface ExprVisitor<H,S> { public interface ExprVisitor<H,S> {

View File

@@ -73,6 +73,12 @@ public class Program{
public String prettyprinter(){ public String prettyprinter(){
return c+""; return c+"";
} }
@Override
public DefineLLVM toLLVM() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'toLLVM'");
}
} }
public static record BinopExpressionImp(Op op,Expression e1, Expression e2) implements Expression{ public static record BinopExpressionImp(Op op,Expression e1, Expression e2) implements Expression{
@@ -92,6 +98,12 @@ public class Program{
} }
return "(" + e1.prettyprinter() +" "+ opStr +" " + e2.prettyprinter() + ")"; return "(" + e1.prettyprinter() +" "+ opStr +" " + e2.prettyprinter() + ")";
} }
@Override
public DefineLLVM toLLVM() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'toLLVM'");
}
} }