progs/token.scala
changeset 529 5c28e4134ee1
parent 521 95af9beb4b7f
child 542 37a3db7cd655
equal deleted inserted replaced
528:68fab15cd6fb 529:5c28e4134ee1
   127 def lexing(r: Rexp, s: String) : Val = lex(r, s.toList)
   127 def lexing(r: Rexp, s: String) : Val = lex(r, s.toList)
   128 
   128 
   129 
   129 
   130 lexing(("ab" | "a") ~ ("b" | ONE), "ab")
   130 lexing(("ab" | "a") ~ ("b" | ONE), "ab")
   131 
   131 
   132 
       
   133 
       
   134 // some "rectification" functions for simplification
   132 // some "rectification" functions for simplification
   135 def F_ID(v: Val): Val = v
   133 def F_ID(v: Val): Val = v
   136 def F_RIGHT(f: Val => Val) = (v:Val) => Right(f(v))
   134 def F_RIGHT(f: Val => Val) = (v:Val) => Right(f(v))
   137 def F_LEFT(f: Val => Val) = (v:Val) => Left(f(v))
   135 def F_LEFT(f: Val => Val) = (v:Val) => Left(f(v))
   138 def F_ALT(f1: Val => Val, f2: Val => Val) = (v:Val) => v match {
   136 def F_ALT(f1: Val => Val, f2: Val => Val) = (v:Val) => v match {