A grammar is formally a tuple $G=(V, \sum, R, S)$

Production rules ⚒️

Let the grammar $G=(\{S\}, \{0,1\}, R,S)$, where

Screenshot 2023-02-10 at 15.43.19.png

<aside> 💡 We replaced $S$ with $_0S_1$ as many times as we wanted (by the rules $R$) and then finished by replacing it with $\epsilon$.

</aside>

And we can say the language of this grammar is

$$ L(G) = \{0^n1^n:n \geq 0\} $$

Language notation

$$ L(G) = \{w \in \Sigma^{}:S \overset{}{\rightarrow} w\} $$

<aside> ⚒️ That is, all strings in $\Sigma^*$ which can be derived from $S$ using finitely many applications of the production rules $R$ for $G$.

</aside>

Left/Right-most derivations

A left most derivation is where rules are applied to the left most non-terminal/variable. Vice versa for right most derivation.

An example of left most derivation:

Screenshot 2023-02-10 at 17.27.44.png

Parse trees