

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find Canonical Parsing Table (CLR) or LR (1) Parsing Table for Grammar. S → CC C → c C | d
Solution
Step1 − Construct Augmented Grammar
(0) S′ → S
(1) S → CC
(2) C → cC
(3) C → d.
Step2 − Find closure & goto to construct LR (1) items
Applying goto on I7, I8, I9
In I7, I8, I9 we have production C → d ∙, $, c → cC ∙, c | d and ∙ C → cC ∙, $ respectively, i.e., the dot cannot be shifted further.
So, goto cannot be applied to I7, I8, I9.
Drawing DFA
First of all, 10 states, i.e.,I0 to I9 will act as nodes for DFA.
Edges are joined using goto statements. For example, goto(I0, S) = I1
∴ There will be an edge from I0 to I1 labeled S.
Similarly, other nodes are connected by seeing all goto statements in LR (1) items of grammar.
- Related Questions & Answers
- Consider the Grammar S → CC C → c C | d Construct the parsing table for LALR (1) parser.
- Constructing LALR (1) Parsing table for a given grammar. Problem− Construct LALR (1) Parsing table for the grammar. S → A a|b A c|dc|bda A → d Parse input string "bdc" using LALR Parsing Table.
- What is Implementation of LR Parsing Tables?
- Construct SLR (1) parsing table for the following grammar S → x A y |x B y |x A z A → q s | q B → q
- Construct the SLR Parsing table for the following grammar. Also, Parse the input string a * b + a.
- Construct a Predictive Parsing table for the following grammar & also check whether string id + id * id is accepted or not.
- How to Fill the Entries in Parsing Table?
- Consider the ambiguous grammar. E → E + E E → E * E E → (E) E → id (a) Construct LR (0) items for above grammar. (b) Construct SLR parsing table for grammar. (c) Parse the input string id + id * id.
- Show that the following grammar is LR (1) S → A a |b A c |B c | b B a A → d B → d
- Program to Find Out the Minimum Parsing Tree in C++
- Parsing Command Line Parameters in C++ Program
- Difference between Top down parsing and Bottom up parsing
- Verifying whether the string id * id + id is accepted by a given grammar using SLR parsing Consider the SLR parsing table for the Grammar E → E + T E → T T → T ∗ F T → F F → (E) F → id Check whether the string id * id + id is accepted or not by using the SLR parsing table constructed in the example.
- Construct SLR (1) parsing table for the grammar 1. E → E + T 2. E → T 3. T → T * F 4. T → F 5.F → (E) 6.F → id
- Parsing a comma-delimited std::string in C++
Advertisements