Skip to content

Instantly share code, notes, and snippets.

letter('2', 'a').
letter('2', 'b').
letter('2', 'c').
letter('3', 'd').
letter('3', 'e').
letter('3', 'f').
letterCombination([D|Ds], [L|Ls]) :- letter(D, L), letterCombination(Ds, Ls).
letterCombination([], []).
@shaobo-he
shaobo-he / match.hs
Last active December 9, 2021 01:52
Matching Regex with Derivatives
module Main where
data Re = Empty | Eps | Dot | C Char | Re :• Re | Re :∪ Re | Star Re
deriving Show
dc :: Char -> Re -> Re
dc _ Empty = Empty
dc _ Eps = Empty
dc _ Dot = Eps
dc c (C c') = if c == c' then Eps else Empty