English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Construct one grammar for each of the following languages:

(a) {an bm : m (b) {w belongs to {a,b}* : w = wR

2007-04-13 20:55:56 · 2 answers · asked by saurabh_044 1 in Science & Mathematics Mathematics

2 answers

(a) {an bm : m
I'm going to assume you mean {a^n . b^m : m < n, m, n ∈Z+}, where Z+ denotes the nonnegative integers and x^m means 'x to the power m' ('xxx...x, m times', or 'm x's in a row').

The nonterminal symbols are {S, B}, S being the start symbol, the alphabet is {a, b}, and the production rules are

(i) S → aB,
(ii) B → aBb,
(iii) aB → a.

Note that this never allows us to have as many or more b's than a's in a string. Let's do an example. To generate a³ b², we apply (i), then apply (ii) twice, then (iii):

S → aB → aaBb→ aaaBbb → aaabb (= a³ b²).

(b) I freely admit that I don't understand what you mean by this. If you edit the question to explain properly, I'll come back and have a go at it.

(And by explain, I mean tell us what the * in {a,b}* is, and what the R in w = wR indicates, etc.)

2007-04-13 22:19:40 · answer #1 · answered by MHW 5 · 0 0

Please explain your question in detail.

2007-04-14 04:06:24 · answer #2 · answered by J.SWAMY I ఇ జ స్వామి 7 · 0 0

fedest.com, questions and answers