progs/lexer/lex.sc
changeset 852 8706b846a3e0
parent 846 3a535de22816
child 936 0b5f06539a84
equal deleted inserted replaced
851:48539905c447 852:8706b846a3e0
   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