This commit is contained in:
Vu Tuan Minh
2025-04-01 17:52:45 +02:00
parent 2a901e4a37
commit 3f9072c7bd
7 changed files with 161 additions and 178 deletions

View File

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