/* Syntax tree for a toy language */ object SimpleAST { type Ident = String sealed abstract class Statement case class AssignStat(lhs : Ident, rhs : Expression) extends Statement case class PrintStat(e : Expression) extends Statement case class IfStat(cond : Expression, trueS : Statement, falseS : Statement) extends Statement case class WhileStat(cond : Expression, body : Statement) extends Statement case class BlockStat(sts : List[Statement]) extends Statement sealed abstract class Expression case class Var(name : Ident) extends Expression case class IntConst(c : Int) extends Expression case class Plus(e1 : Expression, e2 : Expression) extends Expression case class Leq(e1 : Expression, e2 : Expression) extends Expression case class And(e1 : Expression, e2 : Expression) extends Expression abstract class Value case class IntValue(iv : Int) extends Value case object Uninitialized extends Value }