Helios

From Esolang
Jump to navigation Jump to search

Helios is a stack based esolang created by User:ArthroStar11. It is designed to work in Starstuff by User:PixelatedStarfish such that any file can create a valid program, albeit not necessarily useful or functional.

Data Structure

the only data structure in Helios is a stack of 32-bit signed integers.

command list

NOTE: since this language is written for use in Starstuff, commands will be listed by the bytecode generated by a Starstuff to Helios compiler
ALSO NOTE: when variables a and b are mentioned it refers to popping a then b off the stack

  • 0 to 9 push const
    • pushes corresponding number to the stack
  • 10 loop
    • defines the start of a loop, runs code continuously as long as the value popped off the stack is non-zero, can be nested
  • 11 end loop
    • defines the end of a loop
  • 12 add
    • pushes b+a onto the stack
  • 13 subtract
    • pushes b-a onto the stack
  • 14 multiply
    • pushes b*a onto the stack
  • 15 divide
    • pushes b/a onto the stack
  • 16 modulo
    • pushes b%a onto the stack
  • 17 greater than
    • pushes 1 onto the stack if a > b otherwise pushes 0
  • 18 less than
    • pushes 1 onto the stack if a < b otherwise pushes 0
  • 19 equal to
    • pushes 1 onto the stack if a == b otherwise pushes 0
  • 20 not
    • pops top value off the stack pushes 1 onto the stack if the value is 0 otherwise pushes 0
  • 21 print char
    • pops top value off the stack and prints to the console as a character
  • 22 print num
    • pops top value off the stack and prints to the console as a 32-bit signed integer
  • 23 scan char
    • pushes user input onto the stack as a character
  • 24 scan num
    • pushes user input onto the stack as a 32-bit signed integer
  • 25 duplicate
    • pops top value off the stack and pushes two copies onto the stack
  • 26 discard
    • throws away top value of the stack

Sample Programs (using modulo compiler)

Prints "HI"

?>DOK7BK

truth machine

NO@OOLAL

false machine

NJO@OOJLAJL

Print 99 to 0

??D??BB7BO@7COOLA

Alternate 99 to 0 to show the power of Starstuff

?$zZuB'7BO
7C4OL\

Implementation

ArthroStar11's Interpreter and Starstuff to Helios modulo compiler (C++ source)