Post

Compilers - LR Parsing

Compilers - LR Parsing

For $\text{LR}(k)$:

  • $\text{LR}$: From Left to right, derive Rightmost word.
  • $k$: 向右看的字符个数。

Terminology

  • Canonical sentential form (规范句型): sentences derived by rightmost derivation.
  • Canonical reduction (规范规约): left most reduction.
  • Canonical prefix (规范前缀): given canonical sentential form $\alpha \eita$, where $\eita$ is non-terminant or $\varepsilon$, then $\alpha$ is canonical prefix.
  • Canonical viable prefix (规范活前缀): $\alpha$ has form $\alpha’ \pi$, where $\pi$ is a handle or $$.
    • 移入型规范活前缀: $\alpha$ 不含句柄
    • 规约型规范活前缀: $\alpha$ 含一个句柄

Constructing LR automaton

风格出生

$SLR()$

This post is licensed under CC BY 4.0 by the author.