Short answer: Earley’s algorithm parses a context-free grammar in O(n³) time for an input of length n, O(n²) when the grammar is unambiguous, and O(n) for many deterministic grammars. It keeps a chart of items, each a grammar rule with a dot and an origin index. Prediction adds rules…
