Community Answer

Honor CodeSolved 1 Answer

See More Answers for FREE

Enhance your learning with StudyX

Receive support from our dedicated community users and experts

See up to 20 answers per week for free

Experience reliable customer service

Get Started

Set -\rightarrow Implementation of pushdown automata for an airlemetic expression uhereIt verifies that the partonthsis are talaneed.If you are not using parenthesis, it makes sure that the multiplication oporator has more preecdence than the addition or sutstraction cperato.Crammer for design the PDA given in the question is -E \rightarrow E+T|E-T| TT \rightarrow T * F|T / F| FF \rightarrow X|Y|(E) \mid-Falphatet is \sum:\{t,-, *, 1,(, 1,0,1,2,3,4,5,6,7,8,9\}Here Vaurates are: \{E, T, F, x, y\}terminals are: \{0,1,2,3,4,5,6,7,8,9,4,-, *, 1,(),let's rowrite grammer for represent terminal.E \rightarrow E+T|E-T| TT \rightarrow T * F|T / F| FF \rightarrow X|Y|(E) \mid-Fx \rightarrow 012141618Y \rightarrow 1|3| 5 \mid 719NotE: Rule for CFG to P D A(1) A \rightarrow \alpha, A \in V \quad \alpha \in(V+T)^{*} \delta(q, \epsilon, A)=(q, \epsilon)(2) \forall a \in T \cdot \&(a, a, a)=(a, \epsilon)let's design PDA for the above grammer.\rightarrow q.\begin{array}{ll}\delta\left(q_{0}, \epsilon, E\right)=\left(q_{0}, E+T\right) & \delta\left(q_{0}, \epsilon, x\right)=\left(q_{0}, 2\right) \\\delta\left(q_{0}, \epsilon, E\right)=\left(q_{0}, F-T\right) & \delta\left(q_{0}, \epsilon, x\right)=\left(q_{0}, q_{0}\right) \\\delta\left(q_{0}, \epsilon, E\right)=\left(q_{0}, T\right) & \delta\left(q_{0}, \epsilon, x\right)=\left(q_{0}, \sigma\right) \\\delta\left(q_{0}, \epsilon, T\right)=\left(q_{0}, T+F\right) & \delta\left(q_{0}, \epsilon, x\right)=\left(q_{0}, \delta\right) \\\delta\left(q_{0}, \epsilon, T\right)=\left(q_{0}, T / F\right) & \delta\left(q_{0}, \epsilon, \gamma\right)=\left(q_{0}, 1\right) \\\delta\left(q_{0}, \epsilon, T\right)=\left(q_{0}, F\right) & \delta\left(q_{0}, \epsilon, \gamma\right)=\left(q_{0}, \xi\right) \\\delta\left(q_{0}, \epsilon, F\right)=\left(q_{0}, x\right) & S\left(q_{0}, \epsilon, y\right)=\left(q_{0}, \xi\right) \\\delta\left(q_{0}, \epsilon, F\right)=\left(q_{0}, Y\right) & \delta\left(q_{0}, \epsilon, Y\right)=\left(q_{0}, q\right) \\\delta\left(q_{0}, \epsilon, F\right)=\left(q_{0},(E)\right) & \delta\left(q_{0}, \epsilon, \gamma\right)=\left(q_{1}, q\right) \\\delta\left(q_{0}, \epsilon, F\right)=\left(q_{0},-F\right) & \\S\left(q_{0}, \epsilon, x\right)=\left(q_{0}, 0\right) &\end{array}\begin{array}{l}\delta\left(q_{0}, t,+\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0},-,-\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{e}, *, *\right)=\left(q_{e}, \epsilon\right) \\\delta\left(q_{e}, 1,1\right)=\left(q_{e}, \epsilon\right) \\s\left(q_{0}, c, c\right)=\left(q_{2}, \epsilon\right) \\\delta\left(q_{0}, \nu, \nu\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0}, 0,0\right)=\left(q_{0}, \epsilon\right) \quad \delta\left(q_{0}, 5,5\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0}, 1,1\right)=\left(q_{0}, \epsilon\right) \quad \delta\left(q_{0}, 6,6\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0}, 2,2\right)=\left(q_{c}, \epsilon\right) \\\delta\left(q_{2}, 7,7\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0}, 3,3\right)=\left(q_{0}, \epsilon\right) \\\delta\left(q_{0}, 8, \delta\right)=\left(q_{0}, \epsilon\right) \\S(20,4,4)=\left(2_{0}, \epsilon\right) \\S\left(q_{0}, g, q\right)=\left(q_{0}, \epsilon\right) \\\end{array}Let's take an example of airthmetic expression:Inpw: 4 *(2+3)\begin{array}{l}\Rightarrow \quad 2+3), E \text { ) } \\\Rightarrow \quad 2+3), \vec{k}+T) \\\left.\Rightarrow \quad 2+3), \frac{T}{T}+T^{\top}\right) \\\Rightarrow \quad 2+3),(\vec{F}+\stackrel{+}{F}) \\\Rightarrow \quad 2+3),(\dot{x}+\dot{y}) \\\Rightarrow \quad 2+3), 2+3) \\\Rightarrow \quad+3), * 3) \\\begin{array}{ll}\Rightarrow & 31,3) \\\Rightarrow & 37, \times 3)\end{array} \\\Rightarrow \quad \pi, 3 \quad \text {. Heree Anthmatie expression } \\\end{array} ...