Setler v2

From Esolang
Jump to navigation Jump to search

Setler v2 is an esolang where each line stores a value and the main way to do things is by jumping.

Variables & Labels

  • Line 1 → variable a
  • Line 2 → variable b
  • ...
  • Line 26 → variable z
  • Line 27 → variable aa, etc.

The default value of variables is 0.

Supported Data Types

  • String ↔ "text"
    • Escape sequences → "\n", "\t", "\"", "\\", etc.
    • Indexing:
      • Indexing uses { and }a{5}.
      • Slicing uses . and includes both indexes specified → a{1.5}.
  • Int ↔ 5
  • Bool ↔ true / false

Operators

  • Plus + Addition (No concatenation)
  • Minus - Subtraction, Negative numbers
  • Asterisk * Multiplication
  • Slash / Integer division
  • Percent % Modulo

Basic Syntax

  • 5 → stores 5 in the current line’s variable.
  • d: 5 → stores 5 in variable d, regardless of line.
  • $ → current line number.
  • # → current line's value.
  • ; → comment.

Commands

Input - in <prompt>

in "text" → asks for input, stores the result in the current line. b: in "text" → asks for input, stores the result in b.

Output - out <value>

out "text" → outputs the word text. out a → outputs the value in a.

Jump - jmp <line>

jmp 5 → jumps to line 5\.

Jump If Zero - jiz <value> <line>

jiz a 3 → jumps to line 3 if a is 0 or false.

End - end

end → stops the program.

Examples

Truth machine:

in "0 or 1"
out a
jiz a 5
jmp 2
end

FizzBuzz:

a: 1
in "How many FizzBuzz numbers: "
a: a + 1
jiz (a - (b + 1)) 14
jiz (a % 3) 9
jiz (a % 5) 12
out a
jmp 15
out "Fizz"
jiz (a % 5) 12
jmp 15
out "Buzz"
jmp 15
end
out "\n"
jmp 3

99 Bottles Of Beer:

a: 99 
a: a - 1
jiz a 18
jiz a - 1 13
out a
out " bottles of beer on the wall,\n"
out a
out " bottles of beer.\n"
out "Take one down, pass it around,\n"
out a - 1
out " bottles of beer on the wall.\n\n"
jmp 2
out "1 bottle of beer on the wall,\n"
out "1 bottle of beer.\n"
out "Take one down, pass it around,\n"
out "No more bottles of beer on the wall.\n\n"
jmp 2
out "No more bottles of beer on the wall,\n"
out "no more bottles of beer.\n"
out "Go to the store and buy some more,\n"
out "99 bottles of beer on the wall."
end