Defining a right-linear grammar for a language

96 Views Asked by At

Would someone please be able to confirm if my right-linear grammar is correct for the language L?

$L := {b(ab)^na^m | n, m \ge 0}$

Grammar $G(b(ab)^na^m)$
Terminal a,b
Non-terminal S, S1, S2
Start symbol S

Productions:
S -> abS
S -> ab
S1 -> aS1
S1 -> a
S2 -> b

Thanks in advance.

1

There are 1 best solutions below

1
On BEST ANSWER

No, it is not correct e.g take the word $abab\notin \mathcal L$ because the word must start at $b$

$S\to abS \to abab$