Construct a grammar and a PDA for the language:$L = \{ w \in \{a,b\}^* \,|\,\, \#_a(w) = 2\#_b(w) \}$.1. Grammar:My grammar looks like this:$S \to \epsilon \\ S \to aabS, \quad S \to aaSb, \quad S \to aSab, \quad S \to Saab \\ S \to abaS, \quad S \to abSa , \quad S \to aSba, \quad S \to Saba \\ S \to baaS, \quad S \to baSa, \quad S \to bSaa, \quad S \to Sbaa$Maybe there exists a way to simplify it.For example, words like aaabaabbaaab or aabbaa can be created.2. PDA:Now my problem is how should I draw a PDA. It seems very complitcated but it is our first exercise about PDAs, so I guess it should be easy.My first idea is draw a starting state with $\epsilon,\epsilon \to \$ $ (to mark the stack, where the beginning is) and an accepting state with $\epsilon,\$ \to \epsilon$. But what do I do between of that?Thoughts: Always when the PDA reads a 0, push it on top of the stack, when it reads a 1, pop two 0's. But that works only with the right order, so that seems not to be a solution.
Construct a PDA and grammar for the following language
formal languages;context free;formal grammars;pushdown automata