@ijverig while I haven’t used it you may like the library Expat by @vic
Expat - composable, reusable pattern matching