Consider the augmented grammar with as the set of terminals.
If is the set of two items , then contains exactly ______________ items.
View worked solution
Answer: 5
To find the number of items in , we proceed step-by-step:
Step 1: Compute
Given .
In both items, the dot is not placed before any non-terminal (it is at the end in the first item, and before the terminal in the second). Therefore, no expansion is needed:
Step 2: Compute
The function on terminal shifts the dot over in any item where the dot is immediately before . The only such item in is .
Shifting the dot gives the kernel item:
Step 3: Compute the closure of the kernel item
We apply the closure rules to the kernel set:
- Start with the kernel item:
- Since the dot is before the non-terminal , we add all -productions with the dot at the beginning:
- In , the dot is before the non-terminal , so we add all -productions with the dot at the beginning:
Combining all these, the final set of items in is:
Counting the items, we find there are exactly 5 items in the set.
Free practice · Your answers on this page are not saved.
