Hi any second semester students here?

got a question:

when removing unit productions and we have

S --> A

A --> B | b

B --> a

I can easily understand that to remove the unit productions we get

S --> A gives S -> b thus removing S--> A

S --> A --> B gives S --> a thus removing S --> A --> B

A --> B gives A --> a thus removing A --> B

result is:

S --> b | a

A --> a

B --> a

but the assignment has something like this

S --> AA

A --> BB | B

B --> a

what do I do with the AA..?

should I go S --> AA gives

a) S --> B and thus a

b) S --> BB and thus aa

is this correct?

and what if B also --> aa? then a and b above should include all combinations S-->B (thus a | aa) and S --> BB aa | aaa | aaaa

sorry hope this makes some sense, I just need to know if what Im doing is correct, the example in the book doesn't do S -> AA types.

thanks in advance for any guidance

Danie van Eeden

------------------------