EBNF

I need to do this as an extra credit but I also need to refresh my memory as my reading material is not sufficient.

The following three line is what I have to work with;

A -> a E | b A A

E -> a B | b A | e

B -> b E | a B B

For this exercise, consider E to be the start symbol. Show how to derive the following strings. You need to indicate each production that is applied. To distinguish between repeated instances of a nonterminal, use a number. For example, if you apply the 2nd production for A, you may type A -> b A1 A2, then show how A1 and A2 are replaced. You may also use an ordinary 'e' instead of e.

ba

aababb

This is all I have and all I have to do.

Thanks.

[756 byte] By [aligatorsa] at [2007-9-28 19:07:43]
# 1
I think the e was originally an epsilon for empty string..
asjfa at 2007-7-12 17:31:42 > top of Java-index,Other Topics,Algorithms...
# 2

> I think the e was originally an epsilon for empty

> string..

But "HOW" do you drive any of the lines from the first three arguments....."HOW"? if you don't know HOW then please don't respond this reduces my chance of getting someone who knows what he/she is talking about answering my question. Thank you.

aligatorsa at 2007-7-12 17:31:42 > top of Java-index,Other Topics,Algorithms...
# 3

A -> a E | b A A

E -> a B | b A | epsilon

B -> b E | a B B

I've renamed 'e' as 'epsilon' so its not confusing. Epsilon is the empty string "". Also, its best to check it first since I've not done this for a long time.

ba

E -> b A

A -> a E1

E1 -> epsilon

aababb

E -> a B1

B1 -> a B2 B3

B2 -> b E1

E1 -> epsilon

B3 -> a B4 B5

B4 -> b E2

B5 -> b E3

E2 -> epsilon

E3 -> epsilon

asjf

asjfa at 2007-7-12 17:31:42 > top of Java-index,Other Topics,Algorithms...