Skip to content

Instantly share code, notes, and snippets.

View mebusw's full-sized avatar

Jacky Shen mebusw

View GitHub Profile
@yuanmai
yuanmai / CpsRegex.fsx
Last active August 31, 2017 08:45
用 CPS 实现字符串匹配。基于讲座 https://youtu.be/cnhb4M8-J5M
type Re =
| Lit of char
| Seq of Re * Re
| Or of Re * Re
| Star of Re
let rec match2 (re: Re) (str: char list) k =
match re with
| Lit(c) -> match str with
| [] -> false