progs/comb2.scala
changeset 173 7cfb7a6f7c99
parent 172 47b5c91eff47
child 185 ea8b94d4755e
--- a/progs/comb2.scala	Wed Oct 30 15:14:14 2013 +0000
+++ b/progs/comb2.scala	Fri Nov 01 11:57:04 2013 +0000
@@ -111,14 +111,14 @@
 }
 
 lazy val AExp: Parser[String, AExp] = 
-  ((Te ~ "+" ~ AExp) ==> { case ((x, y), z) => Aop("+", x, z): AExp } ||
-   (Te ~ "-" ~ AExp) ==> { case ((x, y), z) => Aop("-", x, z): AExp } || Te)  
+  ((Te ~ "+" ~ AExp) ==> { case ((x, y), z) => Aop("+", x, z):AExp } ||
+   (Te ~ "-" ~ AExp) ==> { case ((x, y), z) => Aop("-", x, z):AExp } || Te)  
 lazy val Te: Parser[String, AExp] = 
-  (Fa ~ "*" ~ Te) ==> { case ((x, y), z) => Aop("*", x, z): AExp } || Fa
+  (Fa ~ "*" ~ Te) ==> { case ((x, y), z) => Aop("*", x, z):AExp } || Fa
 lazy val Fa: Parser[String, AExp] = 
   (("(" ~ AExp ~ ")") ==> { case ((x, y), z) => y } || 
-   IdParser ==> ((s:String) => Var(s) :AExp) || 
-   NumParser ==> ((i:Int) => Num(i) :AExp))
+   IdParser ==> Var || 
+   NumParser ==> Num)
 
 // boolean expressions
 lazy val BExp: Parser[String, BExp] =