progs/comb1.scala
changeset 594 d40d7d7b85bc
parent 593 bb24d4e207b6
child 598 e3ad67cd5123
--- a/progs/comb1.scala	Fri Oct 26 17:13:41 2018 +0100
+++ b/progs/comb1.scala	Sat Oct 27 12:17:03 2018 +0100
@@ -102,6 +102,7 @@
 
 println(E.parse_all("4*2+3"))
 println(E.parse_all("4*(2+3)"))
+println(E.parse_all("(4)*((2+3))"))
 println(E.parse_all("4/2+3"))
 println(E.parse("1 + 2 * 3"))
 println(E.parse_all("(1+2)+3"))
@@ -119,18 +120,6 @@
 //println(EL.parse_all("1+2+3"))
 
 
-// a repetition parser
-
-def RepParser[I  <% Seq[_], T](p: => Parser[I, T]): Parser[I, List[T]] = {
-  p ==> { case x => x :: Nil } |
-  p ~ RepParser(p) ==> { case (x, y) => x :: y }   
-}
-
-
-// a repetition parser
-lazy val R : Parser[String, List[Char]] = RepParser('a') 
-println(R.parse_all("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
-
 
 
 // non-ambiguous vs ambiguous grammars