World's most popular travel blog for travel bloggers.

[Answers] Can a context free grammar for $L$, generate a string not in $L$?

, , No Comments
Problem Detail: 

from Sipster's definition: Any language that can be generated by some context-free grammar (call it $G$) is called a context-free language (CFL). However, can $G$ generate strings that are not in the the language that recognizes $G$?

Asked By : user14864

Answered By : Yuval Filmus

By definition, the language generated by a grammar $G$ is the set of all strings generated by $G$. So a grammar generating a language $L$ can generate only words in $L$ (and conversely, it can generate all words in $L$).

Best Answer from StackOverflow

Question Source :

3.2K people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback