40 lines
988 B
Java
40 lines
988 B
Java
package TP2.asd;
|
|
|
|
import java.util.Map;
|
|
|
|
public interface Interface{
|
|
public interface Expression {
|
|
public <H,S> S accept(ExprVisitor<H,S> v, H h);
|
|
}
|
|
|
|
public interface Instruction {
|
|
public <H,S> S accept(InstrVisitor<H,S> v, H h);
|
|
}
|
|
|
|
public interface ProgramVisitor<H,S> {
|
|
public S visitProgram(Program p, H h);
|
|
public S visitFunction(Program.Function f, H h);
|
|
}
|
|
|
|
public interface InstrVisitor<H,S>{
|
|
public S visitReturn(Program.Return_instr e, H h);
|
|
}
|
|
|
|
public interface ExprVisitor<H,S> {
|
|
public S visitConst(Program.Const e,H h);
|
|
public S visitBinOp(Program.BinopExpression e, H h);
|
|
}
|
|
|
|
public interface Type{
|
|
public String prettyprinter();
|
|
}
|
|
|
|
public enum Op {PLUS, MINUS, TIMES, DIV}
|
|
|
|
//Eval
|
|
public interface ExprEval extends ExprVisitor<Map<String, Integer>, Integer> {
|
|
}
|
|
|
|
public interface TypeCheck extends ExprVisitor<Map<String, Type>, Type> {
|
|
}
|
|
} |