Syntax analysis PartⅡI Chapter 4
2 Bottom-Up Parsing . LR methods (Left-to-right, Rightmost derivation) - SLR, Canonical LR, LALR .Other special cases: - Shift-reduce parsing - Operator-precedence parsing
Operator-Precedence Parsin g Special case of shift-reduce parsing We will not further discuss(you can skip textbook section 4.6)
Shift-Reduce parsing Grammar Reducing a sentence: Shift-reduce corresponds S→ aBE abbcde to a rightmost derivation A→ Abel abcde S→aABe B→d d e a ad e a abe a abcde These match a bbcde roduction's p right-hand sides A A A B B a bbcd ea bbcd ea bbcd ea b bcd
andles a handle is a substring of gr rammar svmbols in a right-sentential form that matches a right-hand side of a production lamma abode S→aABe Abcde A→ Abclb aade H anale B→d a abe a bbcd e a abcde NOT a handle. because aaae further reductions will fail (result is not a sentential form)