EsoChan

From Esolang
Jump to navigation Jump to search
EsoChan
Designed by User:SpaceByte
Appeared in 2022
Computational class Turing Complete
Reference implementation [1]
File extension(s) .chan

EsoChan is an Esolang created mostly on 7/20/22 (July 20th), by User:SpaceByte, however was released on 7/21 and began on 7/19. EsoChan is an esolang themed around stories on 4chan. In EsoChan, there are some references to 4chan storied, like for a program (also called a 'story') to be started it must recieve the line "be program", or else it is stuck in a frozen state. Commands must also have their first argument as a right facing arrow (>), or else it is not executed, and is considered a comment.

Language description

EsoChan is a language based off of the format, language usage, and more properties of 4chan stories. It is semi-psuedonatural, because the language is written in an English like manner of speech, it is not proper English, yet it is still common to be used in online speech, and in this case, 4chan. EsoChan is limited by only having integer variables, only being able to perform addition and subtraction operations, and if statements only containing one line, however, if statements can still be produced by abusing the freeze feature, to essentially uninitialize the story.

If Statement

Stories must always begin with >be program, because by default, the story is in a frozen state since it has not been started, however, with the > freeze program command, you can re-freeze the program once again. Since if statements are one line, you can use some logic to create multi-line if statements.

For example, let's say you have this statement:

> if ascii 104
> print linebreak
> print string hello

There's an issue with this, it will only stop the linebreak from being printed, because if statements are one lines, however, we CAN fix this! First of all, add a > freeze program command right after the if statement.

> if ascii 104
> freeze program
> print linebreak
> print string hello

But why would you do this? All you're doing is preventing the code from being run when it is true? Yes, we are, but we get a similar result, you see, the code IS executed if it's NOT 104, so all you have to do is reverse the statement, making if, an ifnot. Lastly, you want any code after your if statement to work, simply add a > be program command where you want your if statement to end, that way if your statement is false, it freezes the program until the if statement is over, however, this does not account for if statements in if statements, which in many (but not all) cases will cause issues.

Commands

Command Description
print [linebreak/character] OR string [string] Either: Prints a linebreak, prints the ASCII character of the highlighted variable, or prints a pre-defined string.
set it to [int] Set the highlighted variable to [int]
view [variable] Highlight the new, or already set variable [variable]
freeze program Re-freeze the story/program
go [up/down/0] (and if not 0) [int] Add or subtract [int] to the highlighted variable, if you select 0, it sets the variable to 0, and the 3rd argument is not needed.
goto [line] Goto line of the number [line] OR value of variable [line]. The line number commences with the value one (1).
ask Set highlighted variable to ASCII value of user selected character.
if [int] Execute the next command if the highlighted variable is [int]
ifnot [int] Execute the next command if the highlighted variable is not [int]

All commands which first arguments are not > are comments.

Examples

Is H Program

This is one of the programs used for testing, it detects if a character is the letter h

> be program
> print string CLICK THE COOLEST LETTER
> view ascii
> set it to 0
> print linebreak
> ask
> print linebreak
> ifnot 104
> freeze program
> print string WOW YOURE COOL YOU PRESSED h
> print linebreak
> print string ISNT THAT AMAZING
> be program
> if 104
> freeze program
> print string HOW DARE YOU. h IS CLEARLY THE COOLEST LETTER YOU SHALL BE EXECUTED FOR YOUR DISAGREEMENT
> print linebreak
> print string DIE
> be program

Cat Program

The following implements an infinitely repeating cat program:

> be program
> view userInput
> print string Please enter an ASCII character: 
> ask
> print linebreak
> print character
> print linebreak
> goto 3

Truth-Machine

A truth-machine is realized in this program:

> be program
> view userInput
> print string Please input 0 or 1:
> print linebreak
> ask
Input of 0? => Jump to desinent line, which prints and terminates.
> ifnot 49
> goto 10
Input of 1? => Print input, and repeat infinitely.
> print character
> goto 8
> print character

Interpreter

  • Common Lisp implementation of the EsoChan programming language.