I have been asked to convert:
S → Sa | bSb | bc
to LL(1) so far I have:
S → bY
Y → SbF | cF
F → aF | ε
Is this LL(1)? If not would this be LL(1):
S → bY
Y → bYbF | cF
F → aF | ε
if neither of these would somebody please give me the correct answer and why thanks in advance!
This is what I would do:
S → Sa | bSb | bc
Remove left recursion:
F -> aF | EPSILON```
Now left factor:
F -> aF | EPSILON X -> SbF | cF```
Check the First and Follows:
S: b X: b, c F: a, EPSILON``` ```Follows(): S: $, b X: $, b F: $, b``` Everything checks out so it is LL(1) parsable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.