全部书籍

专业

应用 关于 Coach 登录 开始阅读

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

Computer Science · 术语表

什么是 Shift–reduce parsing, handle?

又称: shift--reduce parsing · handle

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

Shift–reduce parsing reads the input from left to right onto a stack, shifting tokens and reducing right sides of productions at the top of the stack to their left sides. A handle of a right sentential form γ\gamma is a production A→βA \to \beta together with a position of β\beta in γ\gamma such that replacing that β\beta by AA gives the previous form of a rightmost derivation of γ\gamma.

The parse tree of id + id * id, each interior node numbered by the reduction that built it. Reduction 8 is the first step of the rightmost derivation on the right, reduction 1 its last.
The parse tree of id + id * id, each interior node numbered by the reduction that built it. Reduction 8 is the first step of the rightmost derivation on the right, reduction 1 its last.
在原文中阅读 →