Strong LL(1) grammar check
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I need to find rules that don't satisfy strong LL(1) rule:
$First_1(alpha*Follow_1(A)) cap First_1(beta*Follow_1(A)) = varnothing$
For any rule $A implies alpha | beta$
I have the following grammar:
$S implies aBA | BCA | epsilon$
$B implies bB | epsilon$
$A implies bB$
$C implies aS | BBS$
I've calculated First and Follow sets:
$First_1(S) = a, epsilon, b $
$First_1(B) = b, epsilon $
$First_1(A) = b $
$First_1(C) = a, epsilon, b $
$Follow_1(S) = $, b $
$Follow_1(B) = $, b, a $
$Follow_1(A) = $, b $
$Follow_1(C) = b $
After that I've started to compute strong LL(1) formula, but have some difficulties with multiplication:
For the rules $S implies aBA, S implies BCA$
$First_1(aBA*Follow_1(S)) cap First_1(BCA * Follow_1(S)) = \ (First_1(aBA) * Follow_1(S)) cap (First_1(BCA) * Follow_1(S)) = \ (a * epsilon, b) cap (a, epsilon, b * epsilon, b). $
From this point I don't know what is the result of those sets multiplications, I've seen the example of usage of this formula with LL(2) grammar and in the end there was $aa, ba * b$ which gave the result $ba, bb$, but for the LL(1) I'm not sure how to correct calculate it.
formal-languages context-free-grammar
add a comment |Â
up vote
0
down vote
favorite
I need to find rules that don't satisfy strong LL(1) rule:
$First_1(alpha*Follow_1(A)) cap First_1(beta*Follow_1(A)) = varnothing$
For any rule $A implies alpha | beta$
I have the following grammar:
$S implies aBA | BCA | epsilon$
$B implies bB | epsilon$
$A implies bB$
$C implies aS | BBS$
I've calculated First and Follow sets:
$First_1(S) = a, epsilon, b $
$First_1(B) = b, epsilon $
$First_1(A) = b $
$First_1(C) = a, epsilon, b $
$Follow_1(S) = $, b $
$Follow_1(B) = $, b, a $
$Follow_1(A) = $, b $
$Follow_1(C) = b $
After that I've started to compute strong LL(1) formula, but have some difficulties with multiplication:
For the rules $S implies aBA, S implies BCA$
$First_1(aBA*Follow_1(S)) cap First_1(BCA * Follow_1(S)) = \ (First_1(aBA) * Follow_1(S)) cap (First_1(BCA) * Follow_1(S)) = \ (a * epsilon, b) cap (a, epsilon, b * epsilon, b). $
From this point I don't know what is the result of those sets multiplications, I've seen the example of usage of this formula with LL(2) grammar and in the end there was $aa, ba * b$ which gave the result $ba, bb$, but for the LL(1) I'm not sure how to correct calculate it.
formal-languages context-free-grammar
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to find rules that don't satisfy strong LL(1) rule:
$First_1(alpha*Follow_1(A)) cap First_1(beta*Follow_1(A)) = varnothing$
For any rule $A implies alpha | beta$
I have the following grammar:
$S implies aBA | BCA | epsilon$
$B implies bB | epsilon$
$A implies bB$
$C implies aS | BBS$
I've calculated First and Follow sets:
$First_1(S) = a, epsilon, b $
$First_1(B) = b, epsilon $
$First_1(A) = b $
$First_1(C) = a, epsilon, b $
$Follow_1(S) = $, b $
$Follow_1(B) = $, b, a $
$Follow_1(A) = $, b $
$Follow_1(C) = b $
After that I've started to compute strong LL(1) formula, but have some difficulties with multiplication:
For the rules $S implies aBA, S implies BCA$
$First_1(aBA*Follow_1(S)) cap First_1(BCA * Follow_1(S)) = \ (First_1(aBA) * Follow_1(S)) cap (First_1(BCA) * Follow_1(S)) = \ (a * epsilon, b) cap (a, epsilon, b * epsilon, b). $
From this point I don't know what is the result of those sets multiplications, I've seen the example of usage of this formula with LL(2) grammar and in the end there was $aa, ba * b$ which gave the result $ba, bb$, but for the LL(1) I'm not sure how to correct calculate it.
formal-languages context-free-grammar
I need to find rules that don't satisfy strong LL(1) rule:
$First_1(alpha*Follow_1(A)) cap First_1(beta*Follow_1(A)) = varnothing$
For any rule $A implies alpha | beta$
I have the following grammar:
$S implies aBA | BCA | epsilon$
$B implies bB | epsilon$
$A implies bB$
$C implies aS | BBS$
I've calculated First and Follow sets:
$First_1(S) = a, epsilon, b $
$First_1(B) = b, epsilon $
$First_1(A) = b $
$First_1(C) = a, epsilon, b $
$Follow_1(S) = $, b $
$Follow_1(B) = $, b, a $
$Follow_1(A) = $, b $
$Follow_1(C) = b $
After that I've started to compute strong LL(1) formula, but have some difficulties with multiplication:
For the rules $S implies aBA, S implies BCA$
$First_1(aBA*Follow_1(S)) cap First_1(BCA * Follow_1(S)) = \ (First_1(aBA) * Follow_1(S)) cap (First_1(BCA) * Follow_1(S)) = \ (a * epsilon, b) cap (a, epsilon, b * epsilon, b). $
From this point I don't know what is the result of those sets multiplications, I've seen the example of usage of this formula with LL(2) grammar and in the end there was $aa, ba * b$ which gave the result $ba, bb$, but for the LL(1) I'm not sure how to correct calculate it.
formal-languages context-free-grammar
asked Jul 30 at 11:33
Kevin
184
184
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2866915%2fstrong-ll1-grammar-check%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password