Implemented pattern parsing and evaluation