progs/lexer/lex.sc
changeset 852 b68252417cf4
parent 846 c24d16c89c48
child 935 3fb9b05465dd
equal deleted inserted replaced
851:2918388fe4ab 852:b68252417cf4
   136 }
   136 }
   137 
   137 
   138 def lexing(r: Rexp, s: String) = 
   138 def lexing(r: Rexp, s: String) = 
   139   env(lex(r, s.toList))
   139   env(lex(r, s.toList))
   140 
   140 
       
   141 println(lex(("ab" | "a") ~ (ONE | "b"), "ab".toList))
       
   142 
       
   143 println(lex(STAR("aa" | "a"), "aaa".toList))
   141 
   144 
   142 // The Lexing Rules for the WHILE Language
   145 // The Lexing Rules for the WHILE Language
   143 
   146 
   144 def PLUS(r: Rexp) = r ~ r.%
   147 def PLUS(r: Rexp) = r ~ r.%
   145 
   148