--- a/solution/cw5/fun_parser.sc Mon Jan 10 23:52:51 2022 +0000
+++ b/solution/cw5/fun_parser.sc Thu Jan 20 08:58:38 2022 +0000
@@ -92,7 +92,7 @@
}
}
-case object FNumParser extends Parser[List[Token], Float] {
+case object FNumParser extends Parser[List[Token], Double] {
def parse(ts: List[Token]) = ts match {
case T_FNUM(x)::ts => Set((x, ts))
case _ => Set()
@@ -129,13 +129,13 @@
case class Def(name: String, args: List[(String, String)], ty: String, body: Exp) extends Decl
case class Main(e: Exp) extends Decl
case class Const(name: String, v: Int) extends Decl
-case class FConst(name: String, x: Float) extends Decl
+case class FConst(name: String, x: Double) extends Decl
case class Call(name: String, args: List[Exp]) extends Exp
case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
case class Var(s: String) extends Exp
case class Num(i: Int) extends Exp // integer numbers
-case class FNum(i: Float) extends Exp // floating numbers
+case class FNum(i: Double) extends Exp // floating numbers
case class ChConst(c: Int) extends Exp // char constant
case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
case class Sequence(e1: Exp, e2: Exp) extends Exp