Re: languages



In article <1139815101.878766.110190@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"jason_box" <cppisfun@xxxxxxxxx> wrote:

Here is the grammar I came up with.

S-> aBa
B-> b | BB | S | lambda

for the gramma L = {a^nb*a^n : a >= 0 }

(You mean "n >= 0").

First, note that your grammar fails to generate the case of n=0.

Second, simplify things by replacing "b*" with just "b". Once you've
solved this, then tweak the answer to generate "b*" rather than "b".

With those 2 hints, have another try at it.

--
---------------------------
| BBB b \ Barbara at LivingHistory stop co stop uk
| B B aa rrr b |
| BBB a a r bbb | Quidquid latine dictum sit,
| B B a a r b b | altum viditur.
| BBB aa a r bbb |
-----------------------------
.