Skip to content

Commit

Permalink
📚 doc: add notes and examples of Watson Representation
Browse files Browse the repository at this point in the history
  • Loading branch information
genkami committed Dec 28, 2020
1 parent 5689716 commit 8e1a000
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions doc/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ The correspondence between VM's instructions and its ASCII representation varies

Each lexer has its own mode. The mode of a lexer is either `A` or `S`. The initial mode of a lexer is `A` unless otherwise specified.

Every time the lexer processes Snew, it flips its mode.

The complete conversion table between instructions and their Watson Representations are as follows:


Expand Down Expand Up @@ -305,3 +307,33 @@ The complete conversion table between instructions and their Watson Representati
|Gpop |# |e |
|Gswp |% |: |

Any character that is not in this table is simply ignored.

### Examples 1

```
B
```

is converted into

```
Inew
```

since the initial state of the lexer is A and the corresponding instruction of a character `B` is `Inew`.

### Example 2

```
b?b
```

is converted into

```
Ishl Snew Fnan
```

since the lexer changes its mode to S after processing a character `?` and then converts the last character `b` using the `S` column of the conversion table.

0 comments on commit 8e1a000

Please sign in to comment.