@!+-()

From Esolang
Jump to navigation Jump to search

@!+-() is an esolang by User:ChuckEsoteric08. Language was named after 6 main commands in the language

Specification

Uses Queue and Accumulator as memory.

@ - enqueue accumulator
! - dequeue element and store it in accumulator
+ - increment accumulator
- - decrement accumulator
( - if accumulator is zero go past matching )
) - go back to matching (
, - output accumulator as ASCII character
. - store ASCII value of user input in accumulator

Examples

Cat

 .(,.)

Print "HI"

++++++++++@(-)@!(-@!+++++++@!)!++,+,

Implementing conditional statements

You could make "if" statement, which would run if accumulator is nonzero (with a caveat that it would set accumulator to 0 after it ran).

If statement

Ask for input and if it is nonzero enqueue it:

.(@(-))

If-else statement

Ask for input and if it is nonzero output it, else output "H":

.@(-)+@!(,@!-@(-))!@!(!(-)++++++++++@(-)@!(-@!+++++++@!)!++,(-))

Truth machine

.------------------------------------------------(++++++++++++++++++++++++++++++++++++++++++++++++,------------------------------------------------)++++++++++++++++++++++++++++++++++++++++++++++++,

External resources