Hacker News new | ask | show | jobs
by backslash_16 1694 days ago
Thanks, this makes a lot of sense. I'd like to think I was slowly closing in on this. Mine isn't as clean as what you put but I made the data within each of the enum possibilities a discrete struct.

  pub enum Expr {
      Binary(BinaryExpr),
      Grouping(GroupingExpr),
      LiteralBool(bool),
      LiteralNil,
      LiteralNumber(f32),
      LiteralString(String),
      Unary(UnaryExpr)
  }