re1.scala
changeset 85 1a4065f965fb
parent 59 b64e876832cc
equal deleted inserted replaced
84:719fd738d2a0 85:1a4065f965fb
    47 }
    47 }
    48 
    48 
    49 // main matcher function
    49 // main matcher function
    50 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r))
    50 def matcher(r: Rexp, s: String) : Boolean = nullable(ders(s.toList, r))
    51 
    51 
       
    52 //example
       
    53 //val r = STAR(ALT(SEQ(CHAR('a'), CHAR('b')), CHAR('b')))
       
    54 //der('b', r)
       
    55 //der('b', r)
    52 
    56 
    53 //one or zero
    57 //one or zero
    54 def OPT(r: Rexp) = ALT(r, EMPTY)
    58 def OPT(r: Rexp) = ALT(r, EMPTY)
    55 
    59 
    56 //n-times
    60 //n-times