all repos

scratch @ cafea316f23d5a3b70a45185c9062fbdd9058b00

⭐ me doing recreational ~~drugs~~ programming

scratch/brainfuck/src/gbf/internal/token.gleam (view raw)

1
pub type Token {
2
  /// Everything that is not one of the tokens below, considered the be
3
  /// a comment.
4
  Comment(String)
5
6
  /// Increment the data pointer by one.
7
  /// `>` symbol
8
  IncrementPointer
9
10
  /// Decrement the data pointer by one.
11
  /// `<` symbol
12
  DecrementPointer
13
14
  /// Increment the byte at the data pointer by one.
15
  /// `+` symbol
16
  IncrementByte
17
18
  /// Decrement the byte at the data pointer by one.
19
  /// `-` symbol
20
  DecrementByte
21
22
  /// Output the byte at the data pointer.
23
  /// `.` symbol
24
  OutputByte
25
26
  /// Accept one byte of input, storing its value in the byte at the data pointer.
27
  /// `,` symbol
28
  InputByte
29
30
  /// If the byte at the data pointer is zero, then instead of moving the
31
  /// instruction pointer forward to the next command, jump it forward to the
32
  /// command after the matching ] command.
33
  /// `[` symbol
34
  StartBlock
35
36
  /// If the byte at the data pointer is nonzero, then instead of moving the
37
  /// instruction pointer forward to the next command, jump it back to the
38
  /// command after the matching [ command.
39
  /// `]` symbol
40
  EndBlock
41
42
  /// End of file
43
  EndOfFile
44
}