65 lines
1.8 KiB
Java
65 lines
1.8 KiB
Java
package TP2.asd;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
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 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 ArrayList<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 ArrayList<AssignLVMImp> toLLVM();
|
|
}
|
|
|
|
public interface ExprVisitor<H,S> {
|
|
public S visitConst(ConstImp e,H h);
|
|
public S visitBinOp(BinopExpressionImp e, H h);
|
|
}
|
|
|
|
public interface Type{
|
|
public String prettyprinter();
|
|
public TypeLLVM toLLVM();
|
|
}
|
|
|
|
public enum Op {PLUS, MINUS, TIMES, DIV, MOD}
|
|
} |