progs/matcher/re1.sc
changeset 913 8f07908dec8d
parent 882 ccb28148bdf3
child 919 d16037caa8fd
equal deleted inserted replaced
912:81f014160a48 913:8f07908dec8d
    53 def matcher(r: Rexp, s: String) : Boolean = 
    53 def matcher(r: Rexp, s: String) : Boolean = 
    54   nullable(ders(s.toList, r))
    54   nullable(ders(s.toList, r))
    55 
    55 
    56 
    56 
    57 
    57 
    58 
    58 val r = SEQ(CHAR('b'), CHAR('c'))
       
    59 matcher(r, "ac")
    59 
    60 
    60 // some examples from the homework
    61 // some examples from the homework
    61 
    62 
    62 val r = STAR(ALT(SEQ(CHAR('a'), CHAR('b')), CHAR('b')))
    63 val r = STAR(ALT(SEQ(CHAR('a'), CHAR('b')), CHAR('b')))
    63 der('a', r)
    64 der('a', r)