Indeed, Ocaml arrays are limited in length, and the parser generator may use arrays internally that would run into the limit for specific grammars (I don't think the memory used is linear in the size of the input in the common use cases). You may be interested in trying to use menhir [1] as a Parser generator instead of ocamlyacc. Menhir is mostly compatible with ocamlyacc, but doesn't use the Parsing module. While I don't think it as done anything specific to support larger input files, the issue may go away (or don't appear on the input sizes you need) using the different menhir implementation. [1] http://gallium.inria.fr/~fpottier/menhir/ Of course, patching ocamlyacc (or any other generator) to fix this issue would be the best way to handle this. But still, switching to a different but 90% compatible software may be a least-effort solution for you -- provided it doesn't have the same issue.