4A: Pattern Matching and Rule-based Substitution