Skip to content

Instantly share code, notes, and snippets.

@GingerIndustries
Created May 15, 2022 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GingerIndustries/4d4ebd40bce43bf90b13d5baf4c49276 to your computer and use it in GitHub Desktop.
Save GingerIndustries/4d4ebd40bce43bf90b13d5baf4c49276 to your computer and use it in GitHub Desktop.

Each instruction has its own line. I've indented some for clarity. Instructions are formatted like this: [symbol][number] 1 [param1] 2 [param2] ... > [next] Numbers and text are formatted like this: [symbol]{[literal] > [next]} Example: w1 1 C1 2 n{1 > *} > w2 means:

  • Write instruction ID 1
  • Parameter 1: C instruction ID 2
  • Parameter 2: number with a value of 1 and halting immidiately
  • Next instruction: write instruction ID 2 An asterisk as the next instruction means "halt"
*w1 1 n{1 > *} 2 n{1 > *} > w2
w2 1 n{0 > *} 2 n{1 > *} > ?1
?1 1 ?2 2 * 3 e1
e1 1 C1 2 n{9 > *} > *
C1 1 n{1 > *} > *
?2 1 P1 2 w3 3 o1
o1 1 n{9 > *} 2 C2 > *
C2 1 n{0 > *} > *
P1 1 +1 > w4
+1 1 +2 2 *1 > *
*1 1 C4 2 C5 > S1
S1 > *
C4 1 n{0 > *} > *
C5 1 n{1 > *} > *
+2 1 1 +3 2 t{" = " > *} > *
+3 1 +4 2 C6 > *
C6 1 n{0 > *} > S2
S2 > *
+4 1 C7 2 t{" * " > *} > *
C7 1 n{1 > *} > *
w3 1 n{0 > *} 2 n{0 > *} > w5
w5 1 +5 2 n{1 > *} > w3
+5 1 C8 2 n{1 > *} > *
C8 1 n{1 > *} > *
w4 1 +2 2 n{0 > *} > ?1
+2 1 C3 2 n{1 > *}
C3 1 n{0 > *}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment