CS154
Chris Pollett
Apr 8, 2020
Letter | `mbox(Aux)` | Production Table | `mbox(Hash)` (Writing only keys, not position values, or pointer to next higher position value) |
---|---|---|---|
a | a | `{}` | `{}` |
b | ab | `{}` | `{ab}` |
b | abb | `{}` | {ab, bb} |
a | abba | `{}` | `{ab, \b\b, ba}` |
b | abbab becomes AbA | `{A->ab}` | `{Ab, bA}` |
a | AbAa | `{A->ab}` | `{Ab, bA, Aa}` |
b | AbAab becomes AbAA | `{A->ab` marked} | `{Ab, bA, \A\A}` |
b | AbAAb becomes BAB | `{A->ab` marked, `B->Ab}` | `{\B\A, \A\B}` |
a | BABa | `{A->ab` marked,`B->Ab}` | `{\B\A, \A\B, \B\a}` |
b | BABab becomes BABA becomes CC | `{A->ab` marked, `B->Ab`, `C->BA}` | `{\C\C}` |
b | CCb | `{A->ab` marked, `B->Ab`, `C->BA}` | `{\C\C, \C\b}` |
a | CCba | `{A->ab` marked, `B->Ab`, `C->BA}` | `{\C\C, \C\b, ba}` |
b | CCbab becomes CCbA | `{A->ab` marked, `B->Ab`, `C->BA}` | `{\C\C, \C\b, \b\A}` |
b | CCbAb becomes CCbB | `{A->ab` marked, `B->Ab` marked, `C->BA}` | `{\C\C, \C\B}` |
On input `w`: (1) Zig-zag across the tape to the corresponding positions on either side of the # symbol to check whether these positions contain the same symbol. If they do not, or if no # is found go into the reject state. If they have the same symbol change the symbol to a new symbol X (on both sides). (2) When all the symbols on the left side of the # have been X'd out, check if there are any more symbols to the right of the #. If yes reject; if not accept.