# Does this grammar generate regular language?

$S \rightarrow AB$

$A \rightarrow aA \mid bA \mid \epsilon$

$B \rightarrow aBb \mid \epsilon$

Does this grammar generate regular language?

According to me this grammar generates language of the form $$L = \{ (a+b)^* a^nb^n \mid n\ge 1\}$$

I think it's a DCFL. If the condition would have been $n\ge0$ then it's regular according to me. But my book says it's regular language.

Am I correct ?

• Why do you think $n\ge 1$? – Rick Decker Oct 24 '17 at 20:28
• @rotia Correct. However, the OP said "According to me this grammar generates ... $n\ge 1". I wondered why. – Rick Decker Oct 25 '17 at 0:05 • We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. – D.W. Oct 25 '17 at 2:40 • Why don't you try to prove your answer correct? Then you'll know whether you are correct. You might start with cs.stackexchange.com/q/11315/755, then try to find a DFA or regular grammar for your language -- see cs.stackexchange.com/q/1331/755 -- then try to find a deterministic PDA for it. – D.W. Oct 25 '17 at 2:41 • It is$n\ge 0$since that's what$B$can generate. If it had been the production$B\rightarrow aBa\mid ab$, then it would have generated$a^nb^n$for$n\ge 1\$ – Rick Decker Oct 27 '17 at 19:20