-- Mar 18 In-Class Exercise
Step 1: Add new start variable to get:
S0 -> S, S -> SS|(S)|a
Step 2: Remove ε rules. In this case, there aren't any so we still
S0 -> S, S -> SS|(S)|a
Step 3: Remove unit rules. We only have one involving
S0 -> SS|(S)|a, S -> SS|(S)|a
Step 4: Split up rules with RHS of length longer than 2
S0 -> SS|( A1| a
S -> SS|( B1|a
A1 -> S)
B1 -> S)
Step 4: Split up rules with RHS of length longer than 2
S0 -> SS|A2, A2 ->( A1| a, A1 -> S)
S -> SS|( B1|a, B2 ->( B1|a, B1 -> S)
----------------------------------------------------
S0 -> SS|A2, A2 -> ( A3, A3 -> A1| a, A1 -> S)
S -> SS|( B1|a, B2 ->( B3, B3 -> B1|a B1 -> S)
(
Edited: 2020-03-21)
Step 1: Add new start variable to get:
S0 -> S, S -> SS|(S)|a
Step 2: Remove ε rules. In this case, there aren't any so we still
S0 -> S, S -> SS|(S)|a
Step 3: Remove unit rules. We only have one involving
S0 -> SS|(S)|a, S -> SS|(S)|a
Step 4: Split up rules with RHS of length longer than 2
S0 -> SS|( A1| a
S -> SS|( B1|a
A1 -> S)
B1 -> S)
Step 4: Split up rules with RHS of length longer than 2
S0 -> SS|A2, A2 ->( A1| a, A1 -> S)
S -> SS|( B1|a, B2 ->( B1|a, B1 -> S)
----------------------------------------------------
S0 -> SS|A2, A2 -> ( A3, A3 -> A1| a, A1 -> S)
S -> SS|( B1|a, B2 ->( B3, B3 -> B1|a B1 -> S)