package TP2.asd; import java.util.ArrayList; import java.util.List; import TP2.asd.Interface.*; public class Program{ public static record ProgramImp(ArrayList instructions){ public S accept(ProgramVisitor v, H h) { return v.visitProgram(this, h); } } public static record Function(Type type, String nom, ArrayList instructions){ public Function(Type type, String name, Instruction instruction) { this(type, name, new ArrayList<>() {{ add(instruction); }}); } public S accept(ProgramVisitor v, H h) { return v.visitFunction(this, h); } } public static record Const(int c) implements Expression{ public S accept(ExprVisitor v, H h) { return v.visitConst(this, h); } } public static record BinopExpression(Op op,Expression e1, Expression e2) implements Expression{ public S accept(ExprVisitor v, H h) { return v.visitBinOp(this, h); } } public static record Return_instr(Expression e) implements Instruction{ public S accept(InstrVisitor v, H h) { return v.visitReturn(this,h); } } public static record Type_void() implements Type{ public String prettyprinter() { return "VOID"; } } public static record Type_int() implements Type{ public String prettyprinter() { return "INT"; } } }