From Esolang
Jump to navigation Jump to search

Minscode is a simple langauge based on the Minsky machine. It has 4 registers. A, B, and C are normal numeric registers, c is a conditional register.


+ Increment the current register.
- If the current register is more than 0, decrement it and set the condition to false. Otherwise, set the condition to true.
A Switch to register A. This is the default register.
B Switch to register B.
C Switch to register C.
! Negate c
() Run the code inside if c is true.
{} Run the code inside until c is true.
, Output the value of the current register.
. Input to the current register. 


Prints out the Fibonacci numbers:

{, { Output A (Initially 0). }
  {-C+B} { Move the value of B to C. }
  {-B+C+A} { Move the value of A to B and C. The value of C is now A+B. }
  {-A+B} { Move the value of B to A. }
  {-C+B} { Move the value of C to B. }
  A+- { Set the condition to false so the loop keeps going. }