Generic VM-based structure matching framework