The BNF Converter (bnfc) is a compiler construction tool generating a compiler front-end from a Labelled BNF grammar.
It can generate an ANTLR grammar for you given a BNF description of OCaml’s syntax.
The first link you gave may be a good starting point but it’s not uptodate (it’s for OCaml 4.02). Maybe an updated version exists somewhere ?
The OCaml grammar in the compiler distribution is written for Menhir. I wonder what it would take to postprocess it to produce a grammar suitable for ocamlyacc? B/c in the past I’ve taken yacc grammars for other languages (e.g. Golang … bletch) and “ported” them to work with ocamlyacc; perhaps the other direction is feasible? the lexer is written for ocamllex; perhaps it can be massaged to be usable with flex? [that’ll be harder – I know that some of the lexemes are scanned with code instead of a regex.
And then, maybe a LALR grammar could be massaged to produce an LL(k) grammar?
I don’t know how feasible this course is. Of course, if it’s at all possible to use a Java Yacc instead of ANTLR, that might make things much easier. As I said, I’ve “ported” Yacc grammars from one Yacc to another. Sure, you have to rip out all the actions and put in new ones, but it’s still far, far superior to having to figure out a deterministic grammar from an ambiguous BNF.