progs/matcher/re1.sc
changeset 913 eef6a56c185a
parent 882 5fcad75ade92
child 919 53f08d873e09
equal deleted inserted replaced
912:e32802acf952 913:eef6a56c185a
    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)