Ø

From Esolang
Jump to navigation Jump to search

Ø(pronounced øh) is a esolang made of random characters on the mac keyboard and is very chaotic.

overview

a basic overview of Ø

syntax

syntax
character description
NOP
«« Push duplicate of top element onto stack
ƒ©œ« Duplicate top two elements and swap them
¥«œ Add top two elements on stack
≠«‹ Subtract top two elements on stack
çç¬ Logical OR between top two elements (1 if either or both are 1, 0 otherwise)
üπ Bitwise OR between top two elements
‘ü¥ü« Modulo operation (remainder after division)
≠» Greater than comparison (pushes 1 if top element is greater than second element, 0 otherwise)
ıı≠ Less than comparison (pushes 1 if top element is less than second element, 0 otherwise)
Ü≈}≈}≈ Duplicate top three elements and rotate them one position down the stack (bottom becomes middle, middle becomes top)
ÜÜÁ Conditional jump: if top element is 0, jump to address stored at second element on stack
»»Á Unconditional jump: jump to address stored at top element on stack
fifi Input: read a character from standard input and push its ASCII value onto the stack
»fi$ Output: pop the top element from the stack and print its character representation (ASCII)
fifiÁ˘ Store the top element on the stack into a memory location at the address provided by the second element
\‰˜ Load the value from the memory location at the address provided by the top element
fi›Œfl Increment the value at the memory location pointed to by the top element
»Á» Decrement the value at the memory location pointed to by the top element
Ñ˝» End of program (terminates execution)
›fiÁ Call subroutine: push the current program counter (address of the next instruction) onto the stack and jump to the address stored at the top element
fiÁ› Return from subroutine: pop the address from the stack and jump to that location (resuming execution after the call)
Á˝Á Clear the stack (remove all elements)
ÁŸ Print a newline character
çççç Comment (ignored by the interpreter)

memory and data

  • Integers (represented on the stack)
  • An array of memory cells accessible using addresses

control flow

  • Jumps (conditional and unconditional)
  • Subroutine calls and returns

IO

  • Input characters from standard input
  • Output characters to standard output

execution

The program starts at the first instruction.
Instructions are executed sequentially.
The stack holds temporary values during execution.
Memory can be used to store long-term data.
The program terminates when the Ñ˝» instruction is encountered.

errors

errors
error reason
non_i using a integer function on a non integer input
non_e referencing something that does not exist
neg_s referencing a negative stack adress

if Ø gets an error it prints the error then deletes the part of the code that makes that error. it does this by deleting the object the program pointer was at when it got an error. then it reruns the program

example

fibonacci numbers:

fififiÁ˘100  ; Store 100 (number of terms) in memory at address 100
fifi0Á˘101  ; Store 0 in memory at address 101 (first term)
fifi1Á˘102  ; Store 1 in memory at address 102 (second term)
»»Á1      ; Jump to the start of the loop
‹‹¥«œ      ; Calculate next term (top two elements from memory)
fi›Œfl101   ; Increment first term in memory
»Á»102   ; Decrement counter in memory
ıı≠Ü≈}≈}≈  ; Loop if counter is greater than 0 (rotate and compare)
»fi$        ; Output the top element (current Fibonacci number)
Ñ˝»        ; End of program

truth machine:

fififiÁ˘100  ; Store address for loop counter (initially 0)
»fi$        ; Get user input

ıı≠Ü≈}≈}≈  ; Check if input is 1 (rotate and compare)
»Á100      ; Jump to loop if input is 1

»fi$        ; Otherwise, output the input (0)
Ñ˝»        ; End program

‹‹¥«œ      ; Calculate next loop counter (always 1)
fi›Œfl100   ; Increment loop counter
»Á1        ; Jump back to the beginning of the loop (infinite loop for 1)

Ñ˝»        ; End program (unreachable for input 1)

notes

  • the stack is a infinite stack so stack overflow does not exist
  • if you refrence the stack without there being anything in the stack just returns 0 so stack underflow does also not exist
  • the memory array is infinite
  • the array is numbered with big endian
  • there is no integer limit
  • floats can only be in the memory array
  • if you do not add a Ñ˝» then the Ø program will never end
  • operations are separated by space or _