01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package visitor.typecase;
import enumeration.Op;

public interface Expr { }

class Const implements Expr {
  public final int c;
  public Const(int c) {
    this.c = c;
  }
}

class BinOp implements Expr {
  public final Expr l;
  public final Expr r;
  public final Op op;

  public BinOp(Expr l, Op op, Expr r) {
    if ((l == null) || (op == null) || (r == null)) {
      throw new IllegalArgumentException();
    }
    this.op = op;
    this.l = l;
    this.r = r;
  }
}