next up previous
Next: Automata Up: Grammar Previous: Grammar

Applying production rules:

Let $G = (V, T, S, P)$ be a grammar. Then the set

\begin{displaymath}L(G) = \{ w \in T^*:  S \stackrel{\ast}{\Rightarrow} w \} \end{displaymath}

is the language generated by $G$.
\begin{example}
Consider the grammar $G_1= (\{S\}, \{ a, b\}, S, P )$, where
...
...in{displaymath}S \rightarrow aSb \vert \lambda.\end{displaymath}
\end{example}

\begin{example}
Consider the grammar $G_2= (\{S\}, \{ a, b\}, S, P )$, where
...
...rightarrow aSb  \vert bSa  \vert  \lambda.
\end{displaymath}
\end{example}
Let $n_a(w)$ denote the number of a's in the string $w$.
\begin{question}
Is $L(G_2)$ equivalent to the following language
$L = \{ w  \vert  n_a(w) = n_b(w) \}$.
\end{question}
Two grammars are equivalent if they generate the same language.

xiangyang li 2000-09-06