Date: 2017-11-14
Categories: ocaml; software; parsing

New OCaml parsing algorithm: tjr_simple_earley

A while ago, I wrote a parsing algorithm loosely based on the ideas behind Earley parsing. The aim was to produce an algorithm that was:

The resulting code and documentation is on github at https://github.com/tomjridge/tjr_simple_earley

The examples in src/bin include the grammar E -> E E E | "1" | eps, with an input of length 400. This can be parsed in under 3s. As far as I know, most general-purpose parsers cannot handle anywhere near this length. For example, Haskell's Happy parser takes two minutes to handle an input of length 60 (and can't handle much longer inputs).


Related posts: