Skip to content

Instantly share code, notes, and snippets.

@rockey5520
Created October 15, 2020 13:01
Show Gist options
  • Save rockey5520/aff5abe737bea57f07e4ce845627f1d5 to your computer and use it in GitHub Desktop.
Save rockey5520/aff5abe737bea57f07e4ce845627f1d5 to your computer and use it in GitHub Desktop.
package com.example.expression;
public sealed interface Expr
permits ConstantExpr, PlusExpr, TimesExpr, NegExpr {...}
public record ConstantExpr(int i) implements Expr {...}
public record PlusExpr(Expr a, Expr b) implements Expr {...}
public record TimesExpr(Expr a, Expr b) implements Expr {...}
public record NegExpr(Expr e) implements Expr {...}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment