progs/lexer/lexer.sc
changeset 826 b0352633bf48
parent 800 9eea6a801e10
child 827 67c8a6e6a305
equal deleted inserted replaced
825:dca072e2bb7d 826:b0352633bf48
   141 }
   141 }
   142 def F_SEQ_Empty1(f1: Val => Val, f2: Val => Val) = 
   142 def F_SEQ_Empty1(f1: Val => Val, f2: Val => Val) = 
   143   (v:Val) => Sequ(f1(Empty), f2(v))
   143   (v:Val) => Sequ(f1(Empty), f2(v))
   144 def F_SEQ_Empty2(f1: Val => Val, f2: Val => Val) = 
   144 def F_SEQ_Empty2(f1: Val => Val, f2: Val => Val) = 
   145   (v:Val) => Sequ(f1(v), f2(Empty))
   145   (v:Val) => Sequ(f1(v), f2(Empty))
   146 def F_RECD(f: Val => Val) = (v:Val) => v match {
   146 
   147   case Rec(x, v) => Rec(x, f(v))
       
   148 }
       
   149 def F_ERROR(v: Val): Val = throw new Exception("error")
   147 def F_ERROR(v: Val): Val = throw new Exception("error")
   150 
   148 
   151 // simplification
   149 // simplification
   152 def simp(r: Rexp): (Rexp, Val => Val) = r match {
   150 def simp(r: Rexp): (Rexp, Val => Val) = r match {
   153   case ALT(r1, r2) => {
   151   case ALT(r1, r2) => {