Actually, I think it is not that difficult: all you have to do is have the same parsing rule for expressions and patterns. In other words, merge the two together (possibly also merge the AST) and disambiguate as a second step. This is possible because most patterns (except as
, exception
and maybe a few others?) use basically the same syntax as expressions.
Maybe there are some corner-cases in OCaml where it just does not work, but I implemented a couple languages where I did exactly that.