- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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.
Advertisements
To Continue Learning Please Login
Login with Google