```
In [1]:
```from tock import *

```
In [2]:
```m = read_csv("../examples/sipser-2-14.csv")
m.is_finite(), m.is_pushdown(), m.is_deterministic()

```
Out[2]:
```

```
In [3]:
```to_table(m)

```
Out[3]:
```

The first column lists the states, just as in a FA. The first row lists pairs of input symbols and popped stack symbols. Note that this is a little different from Sipser, who uses two header rows, one for stack symbols and one for input symbols.

The cells contain pairs of new states and pushed stack symbols. So, if the machine is in state `q2`

, and the next input symbol is `0`

, then the machine stays in state `q2`

and pushes a `0`

onto the stack. If a cell has multiple tuples, then each tuple must be enclosed in parentheses.

Here's the state transition diagram:

```
In [4]:
```to_graph(m)

```
```

`->`

for a right arrow.

```
In [5]:
```run(m, "0 0 0 1 1 1")

```
```

The nodes of the run now show the contents of the stack as well. The top symbol of the stack is marked with square brackets. If the stack gets too deep, then only the top few elements are shown, with an ellipsis instead of the rest of the stack. You can change how many stack elements are displayed using the `show_stack`

option, which defaults to 3. (More about ellipses below.)

This is a deterministic PDA. That's not very exciting, so let's try a nondeterministic PDA. This one (Example 2.18) accepts strings of the form $\{ww^R\}$.

```
In [6]:
```m = read_csv("../examples/sipser-2-18.csv")
m.is_finite(), m.is_pushdown(), m.is_deterministic()

```
Out[6]:
```

```
In [7]:
```to_table(m)

```
Out[7]:
```

```
In [8]:
```to_graph(m)

```
```

```
In [9]:
```run(m, "0 0 1 1 0 0")

```
```

`#`

signs, reads in a single `0`

, then pops all the `#`

signs again:

```
In [10]:
```m = read_csv("../examples/pdaloop.csv")
to_graph(m)

```
```

```
In [11]:
```run(m, "0")

```
```

`#`

signs are pushed and popped.