Phase 2 – Syntax Analysis

What you will learn

Understanding Priority selection of operators by operator precedence parsing

Parsing the input string by Simple LR parser

Parsing the input string by Canonical LR parser

Parsing the input string by Lookahead LR parser

Identification of most powerful parsing technique

Description

A bottom-up parser creates the parse tree for a given input string starting from leaves towards the root. A bottom-up parser tries to find the right-most derivation of the given input string in the reverse order. Bottom-up parsing is also known as shift-reduce parsing. Bottom-up parsing is the process of “reducing” a string ‘w’ to the start symbol of the grammar. At each reduction step, a particular substring matching the right-side of a production is replaced by the symbol on the left-side of the production. If the substring is chosen correctly, a right most derivation is traced out in reverse. A general style of bottom-up syntax analysis, known as shift-reduce parsing. Two types of bottom-up parsing: Operator-Precedence parsing – an easy to implement form of shift reduce parsing. LR parsing – a much more general form of Shift Reduce Parsing. LR parsing is used in a number of automatic parser generators. Informally a Handle of a string ‘w’ is a substring that matches the RHS of some production and whose reduction to the non-terminal on the LHS of the production represents one step along the reverse of a rightmost derivation. But not every substring that matches the right side of a production rule is handle. A rightmost derivation in reverse can be obtained by “handle-pruning.”


Get Instant Notification of New Courses on our Telegram channel.


English
language

Content

operator precedence parsing introduction.mp4

Introduction

computation of leading and trailing

Section 2

operator precedence table

operator precedence table

operator precedence parsing the input

operator precedence parsing the input

Simple LR Parsing

Simple LR Parsing

Canonical LR Parsing

Canonical LR Parsing

Canonical -CLR parsing the input string

Canonical -CLR parsing the input string

Lookahead LR Parsing

Lookahead LR Parsing