### Solution Found!

# Convert the CFG G4 given in Exercise 2.1 to an equivalent

**Chapter , Problem 2.11**

(choose chapter or problem)

**QUESTION:**

Convert the CFG G4 given in Exercise 2.1 to an equivalent PDA, using the procedure given in Theorem 2.20.

### Questions & Answers

**QUESTION:**

Convert the CFG G4 given in Exercise 2.1 to an equivalent PDA, using the procedure given in Theorem 2.20.

**ANSWER:**

Problem 2.11

Convert the CFG given in Exercise 2.1 to an equivalent PDA, using the procedure given in Theorem 2.20.

Theorem 2.20

A language is context free if and only if some pushdown automaton recognizes it.

Step by Step Solution

Step 1 of 2

Given, CFG ,

The formal details of the construction of the pushdown automaton . To make the construction clearer, we use shorthand notation for the transition function. This notation provides a way to write an entire string on the stack in one step of the machine. We can simulate this action by introducing additional states to write the string one symbol at a time.

The following is an informal description of P :

- Place the marker symbol and the start variable on the stack.
- Repeat the following steps forever.

- If the top of stack is a variable symbol, nondeterministically select one of the rules for the variable and substitute the variable by the string on the right-hand side of the rule.
- If the top of stack is a terminal symbol, read the next symbol from the input and compare it to the symbol. If they match, repeat. If they do not match, reject this branch of nondeterminism.
- If the top of stack is the symbol , enter the accept state. Doing so accepts the input if it has all been read.