> 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/slr1.md).

# SLR(1) parser

## Basic idea

Simple LR(1): an LR(0) automaton augmented with FOLLOW-set lookahead — reduce by $A \to \alpha$ only when the next token is in $\mathrm{FOLLOW}(A)$. Stronger than LR(0), weaker than LALR(1), cheap to construct.

## Key formulas

* Parse time: $O(n)$
* Reduce on $A \to \alpha$ allowed iff lookahead $\in \mathrm{FOLLOW}(A)$.
* Power: LR(0) $\subsetneq$ SLR(1) $\subsetneq$ LALR(1) $\subsetneq$ LR(1).
