edited by
964 views
2 votes
2 votes
what is the regular grammar for L={$a^nb^m$ | n+m is even}
edited by

1 Answer

2 votes
2 votes

Writing Regular Grammar for a language is much Harder than Making an FA for that language. In the GATE or other Objective exams, You will not be asked to write a Regular Grammar for a language. In GATE, You can simply eliminate the Grammars given in the Options by checking if they genertate the strings of the language or not. 

Now coming to the Question, To write Regular Grammar for any Regular language, the simplest method (sometimes time consuming maybe but Less Error Prone) will be to build a NFA and then write Right-linear Grammar from that FA. 

First Construct NFA for the given language and then directly write Right Linear Grammar from it. 

Or You can construct DFA and then Write Rigth linear Grammar from that. 

You can simplify the Grammar obtained and remove Useless symbols etc.

Practice writing Right linear Grammar from FA. 

Related questions

1 votes
1 votes
0 answers
2
0 votes
0 votes
1 answer
3