LLVM + interface visitor
This commit is contained in:
@@ -1,46 +1,52 @@
|
||||
package TP2.asd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import TP2.asd.Program.*;
|
||||
import TP2.llvm.Interface.*;
|
||||
import TP2.llvm.ProgramLLVM.*;
|
||||
|
||||
public interface Interface{
|
||||
//////////Program
|
||||
public interface ProgramI {
|
||||
public <H,S> S accept(ProgramVisitor<H,S> v, H h);
|
||||
public String prettyprinter();
|
||||
public ProgramLLVMImpl toLLVM();
|
||||
}
|
||||
public interface Function {
|
||||
public <H,S> S accept(FunctionVisitor<H,S> v, H h);
|
||||
public String prettyprinter(String indent);
|
||||
public DefineLLVM toLLVM();
|
||||
}
|
||||
public interface Instruction {
|
||||
public <H,S> S accept(InstrVisitor<H,S> v, H h);
|
||||
public String prettyprinter(String indent);
|
||||
public InstructionLLVM toLLVM();
|
||||
}
|
||||
|
||||
public interface Expression {
|
||||
public <H,S> S accept(ExprVisitor<H,S> v, H h);
|
||||
public String prettyprinter();
|
||||
}
|
||||
|
||||
public interface ProgramVisitor<H,S> {
|
||||
public S visitProgram(ProgramImp programImp, H h);
|
||||
}
|
||||
|
||||
//////////Function
|
||||
public interface Function {
|
||||
public <H,S> S accept(FunctionVisitor<H,S> v, H h);
|
||||
public String prettyprinter(String indent);
|
||||
public DefineLLVM toLLVM();
|
||||
}
|
||||
|
||||
public interface FunctionVisitor<H,S> {
|
||||
public S visitFunction(FunctionImp e, H h);
|
||||
}
|
||||
|
||||
//////////Instruction
|
||||
public interface Instruction {
|
||||
public <H,S> S accept(InstrVisitor<H,S> v, H h);
|
||||
public String prettyprinter(String indent);
|
||||
public InstructionLLVM toLLVM();
|
||||
}
|
||||
|
||||
public interface InstrVisitor<H,S>{
|
||||
public S visitReturn(Return_instrImp e, H h);
|
||||
public S visitAssign(AssignImp e, H h);
|
||||
}
|
||||
|
||||
//////////Expression
|
||||
//We put prettyprinter here beause each expr will have to implement it like accept visitor
|
||||
//but each implement will be different for prettyprinter
|
||||
public interface Expression {
|
||||
public <H,S> S accept(ExprVisitor<H,S> v, H h);
|
||||
public String prettyprinter();
|
||||
}
|
||||
|
||||
public interface ExprVisitor<H,S> {
|
||||
public S visitConst(ConstImp e,H h);
|
||||
public S visitBinOp(BinopExpressionImp e, H h);
|
||||
|
||||
Reference in New Issue
Block a user