TapeRun
Jump to navigation
Jump to search
TapeRun is a stack-based programming language which aims to take programmers back to a simpler time. The program consists of a tape, the has a command for each line, and one character is used as the alignment character, to ensure everything runs smoothly.
Here is the rundown of the tape commands.
|# Take character as input onto the stack # | Output top of stack as character ##| Pop top of stack # |# Clone top of stack #|# Add to top of stack #| Run until equal to value (represented in 3 bit binary until next separator, runs until the separator after that) ##|# Close for above statement
Since loops are a bit difficult to explain, here is an example:
#| Start loop ##| 6 + ##| 6 + # | 4 = ##|# 16 #|# Add one until the top of the stack is 16 ##|# Close loop
Note that the binary representation of 6 is used instead of 7 because 7 is ##|#
.
For comments the language will only take in the first 4 characters of each line, so any characters afterwards are ignored.
Here is now "Hello World!":
# |# Create initial stack value #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 = ##|# 72 #|# +1 to top of stack ##|# Run until top of stack is 72 ("H") # | Output "H" #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + # | 4 = ##|# 100 #|# +1 to top of stack ##|# Run until top of stack is 100 ("d") # |# Clone top of stack #|# +1 to top of stack # | Output "e" #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack (It is now at "l") # | Output "l" # | Output "l" # |# Clone top of stack #|# +1 to top of stack #|# +1 to top of stack #|# +1 to top of stack (It is now at "o") # | Output "o" # |# Clone top of stack #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + #| 2 = ##|# 32 #|# +1 to top of stack (Wraps back around at 255) ##|# Run until top of stack is 32 (" ") # | Output " " #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + #|# 6 = ##|# 87 #|# +1 to top of stack ##|# Run until top of stack is 87 ("W") # | Output "W" ##| Pop top of stack # | Output "o" #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 = ##|# 114 #|# +1 to top of stack ##|# Run until top of stack is 114 ("r") # | Output "r" ##| Pop top of stack # | Output "l" ##| Pop top of stack # | Output "d" #| Start loop ##| 6 + ##| 6 + ##| 6 + ##| 6 + ##| 6 + #|# 3 = ##|# 33 #|# +1 to top of stack ##|# Run until top of stack is 114 ("!") # | Output "!"
Here is the python interpreter.