> For the complete documentation index, see [llms.txt](https://isubasinghe.gitbook.io/isithas-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://isubasinghe.gitbook.io/isithas-wiki/computer_science/programming_language_theory/parsers/lr0.md).

# LR(0) parser

## Basic idea

Bottom-up shift-reduce parser with *zero* lookahead. Uses the canonical collection of LR(0) items as states; reduce whenever a final item is present. Weak — many grammars have shift/reduce or reduce/reduce conflicts here.

## Key formulas

* Parse time: $O(n)$
* States = items closed under $\mathrm{GOTO}$
* LR(0) item: $A \to \alpha \cdot \beta$
* Strictly weaker than SLR(1), LALR(1), LR(1).
