switch gr

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

switch gr is an esolang based on Tiny Gr, Whitespace and Piet created by User:Ractangle

Swiches

switch gr has 2 swiches:

  • on/off
  • mode

Syntax

Parts

A part is self explanatory. it's a part of the program

a line of a switch gr program is 2 (or 3 if you count the IMP part separate) parts:

  • The IMP
  • The command
  • The arguments

The IMP

Just like in Whitespace, there is also an IMP, and you also have to retype the IMP once you end the current line's code

For simplicity sake, the following code will be shown using the bit method
Code Meaning
00 00 Stack manipulation
00 10 Flow-control
10 00 I/O
10 10 Arithmetics

The commands

  • Stack manipulation
    • 00 00 - push a value to stack
    • 00 10 - pop a value and push it to the other stack
    • 10 00 - push the bos to the top and repeat that int(tos)-1 times
    • 10 10 - pop the tos from the other stack and add it to the main stack
  • Flow-control
    • 00 00 - create a label
    • 00 10 - jump to a label unconditonaly
    • 10 00 - jump to a label if the tos is zero
    • 10 10 - jump to a label if the tos is equel to the next argument
  • I/O
    • 00 00 - charecter output
    • 00 10 - numeric output
    • 10 00 - chrecter input
    • 10 10 - numeric input
  • Arithmetic

Examples