Inklings: a tumblelog

Earley parser

[T]he Earley parser is an algorithm for parsing strings that belong to a given context-free language, named after its inventor, Jay Earley. The algorithm is a chart parser that uses dynamic programming, and is mainly used for parsing in computational linguistics.

Earley parsers are appealing because they can parse all context-free languages, unlike LR parsers and LL parsers which are more typically used in compilers but which can only handle restricted classes of languages. The Earley parser executes in cubic time in the general case O(n3), where n is the length of the parsed string, quadratic time for unambiguous grammars O(n2), and linear time for almost all LR(k) grammars. It performs particularly well when the rules are written left-recursively.