Programme Name B.
Tech CSE Semester : Fall Semester 2025-2026
Course Code and Course BCSE307P – Compiler Design Assessment Lab Assignment - 8
Title Lab Type:
Faculty Dr. P. S. Sreeja Slot No (L19+L20) & (L57+L58)
Submission Starts From 28.08.2025 Due Date 03.09.2025
Implementation of LR(0) Parser
Algorithm:
1. Augment the grammar with the new start symbol.
2. Construct the canonical collection of LR(0) items.
3. Compute closure() and goto() step by step.
4. Draw the DFA of LR(0) items.
5. Construct the LR(0) parsing table (ACTION and GOTO).
Input:
Grammar rules.
S' → S
S → C C
C → c C | d
Input string to be parsed : (ccdd).
Output:
Canonical collection of LR(0) items.
DFA of item sets (as state transitions).
LR(0) Parsing Table (ACTION and GOTO).
Parsing trace for the given input string showing:
o Stack contents
o Input buffer
o Action (shift/reduce/accept/error)
Rubrics:
Source code Poor Good Excellent
2 Marks 3 Marks 4 Marks
Canonical collection of Poor Good Excellent
LR(0) items. 1 Mark 1.5 Marks 2 Marks
DFA of item sets Poor Good Excellent
1 Mark 2 Marks 3 Marks
LR(0) Parsing Table Poor Good Excellent
1 Mark 2 Marks 3 Marks
Stack Implementation Poor Good Excellent
1 Mark 2 Marks 3 Marks
Handwritten Solution Poor Good Excellent
2 Marks 3 Marks 4 Marks
On time Submission More than one One week late On or before due
week late date
0 Marks 0.5 Marks 1 Mark
Source code Poor Good Excellent
2 points 3 points 4 points
Canonical collection of 1 points 1.5 points 2 points
LR(0) items.
Parse Table 1 points 2 points 3 points
Test Case 1- stack Poor partially Correct Perfect
implementation
1 point 2 points 3 points
Test Case 2- Stack Poor partially Correct Perfect
Implementation
1 point 2 points 3 points
Handwritten Solution Poor Good Excellent
2 points 3 points 4 points
On time Submission More than one One week late On or before due
week late date
0.5 points
0 points 1 points