全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 SLR table, shift–reduce and reduce–reduce conflicts?

又称: SLR table · shift--reduce conflict · reduce--reduce conflict

Definition 3.6 University Computer Science — Year 3 · 第 3 章 — Bottom-Up Parsing

The SLR table of a grammar has a row per state of its LR(0) automaton. Its action part has a column per terminal and $: cell [I,a][I, a] holds shift JJ if the automaton moves from II to JJ on aa, reduce A→βA \to \beta if A→β ⋅A \to \beta\,\cdot is in II and a∈FOLLOW(A)a \in \mathrm{FOLLOW}(A), and accept if a=$a = \$ and Start→S ⋅\mathit{Start} \to S\,\cdot is in II. Its goto part has a column per nonterminal, read from the automaton’s moves. A cell with a shift and a reduce is a shift–reduce conflict; a cell with two reduces is a reduce–reduce conflict. A grammar is SLR if its table has no conflict.

在原文中阅读 →