全部书籍

专业

应用 关于 Coach 登录 开始阅读

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

Computer Science · 术语表

什么是 Viable prefix, LR(0) automaton?

又称: viable prefix · LR(0) automaton

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

An item A→β⋅δA \to \beta \cdot \delta is valid for a string γ\gamma of grammar symbols if Start⇒rm∗αAw⇒rmαβδw\mathit{Start} \Rightarrow^*_{\mathrm{rm}} \alpha A w \Rightarrow_{\mathrm{rm}} \alpha\beta\delta w with γ=αβ\gamma = \alpha\beta. A viable prefix is a string for which some item is valid: a prefix of a right sentential form that does not run past the end of its handle. The LR(0) automaton of a grammar has as start state the closure of {Start→⋅ S}\{\mathit{Start} \to \cdot\,S\}, as states every set reachable from it by the goto function, and a transition labelled XX from II to goto(I,X)\mathrm{goto}(I, X) whenever that set is not empty.

The LR(0) automaton of the expression grammar. Each box shows the kernel items (those whose dot is not at the start, and the start rule); the closure adds the others, as in I0. The moves that would cross the picture are written in the box as “also” symbol:target. A state with an item whose dot is at the end (I1, I2, I3, I5, I9, I10, I11) may reduce.
The LR(0) automaton of the expression grammar. Each box shows the kernel items (those whose dot is not at the start, and the start rule); the closure adds the others, as in I0. The moves that would cross the picture are written in the box as “also” symbol:target. A state with an item whose dot is at the end (I1, I2, I3, I5, I9, I10, I11) may reduce.
在原文中阅读 →