73 lines
1.8 KiB
Java
73 lines
1.8 KiB
Java
package TP2.asd;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import TP2.asd.Program.*;
|
|
import TP2.asd.toLLVM_Visitor.InstrOrVal;
|
|
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 prog, H h);
|
|
}
|
|
|
|
|
|
//////////Function
|
|
public interface Function {
|
|
public <H,S> S accept(FunctionVisitor<H,S> v, H h);
|
|
}
|
|
|
|
public interface FunctionVisitor<H,S> {
|
|
public S visitFunction(FunctionImp fun, H h);
|
|
}
|
|
|
|
|
|
//////////Instruction
|
|
public interface Instruction {
|
|
public <H,S> S accept(InstrVisitor<H,S> v, H h);
|
|
}
|
|
|
|
public interface InstrVisitor<H,S>{
|
|
public S visitReturn(Return_instrImp instr, H h);
|
|
public S visitAssign(AssignImp instr, H h);
|
|
public S visitDeclaration(DeclarationImp instr,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 interface ExprVisitor<H,S> {
|
|
public S visitConst(ConstImp e,H h);
|
|
public S visitBinOp(BinopExpressionImp e, H h);
|
|
public S visitVar(VarImp e,H h);
|
|
}
|
|
|
|
public interface Type{
|
|
public <H,S> S accept(TypeVisitor<H,S> v, H h);
|
|
}
|
|
|
|
public interface TypeVisitor<H,S>{
|
|
public S visitInt(Type_intImp t, H h);
|
|
public S visitVoid(Type_voidImp t, H h);
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum Op {PLUS, MINUS, TIMES, DIV, MOD}
|
|
} |