EBNF

Does anyone know how to derive "aababb" from the followingA -> a E | b A A E -> a B | b A | e B -> b E | a B B please?
[169 byte] By [aligatorsa] at [2007-9-28 19:04:23]
# 1
You've got the specify the start symbol!
YATArchivista at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...
# 2
Wait. No you don't. It's irrelevant, because it's impossible to construct your string with any of them as start symbol.
YATArchivista at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...
# 3

There is no derivation for the given string.

This is proven by observing that every string in the grammar ends with an 'e'. This is easily verifiable from observing that 'A' is either recursive or leads to 'E', similarly for 'B' (doubly recursive).

The only derivation containing only terminals is 'E -> e' This means that every string must end in an 'e'. This also implies that every 'E' must eventually derive an 'e'.

drmadskillsa at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...
# 4
You'll derive the first 5 symbols but not the last one.
Nikita04a at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...
# 5
I think the e was originally an epsilon for empty string..(he gives more info in his second post of the same name)
asjfa at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...
# 6

Does anyone know how to derive

"aababb" from the following

A -> a E | b A A

E -> a B | b A | e

B -> b E | a B B

Well if that's the case, the string is derivable if and only if the start symbol is E:

E -> aB -> aaBB -> aabEB -> aabB -> aabaBB ->aababEbE ->aababb

It is not derivable if the start symbol is B because there will be an incorrect number of B's derived no matter what derivation is taken. And 'A' just won't work.

drmadskillsa at 2007-7-12 17:26:58 > top of Java-index,Other Topics,Algorithms...