Chair

From Esolang
Jump to navigation Jump to search

Chair is a joke language created by CoolJarreb99, where every variable is a chair, and only one variable can be used at a time, variables have to be deconstructed and reconstructed to be read or modified, etc.

Chair
Designed by User:CoolJarreb99
Appeared in 2026
Computational class Unknown
Reference implementation Unimplemented
File extension(s) .chair

Syntax

Every line in Chair is seperated by a newline. Every argument of a command is seperated with a whitespace. If an argument does not support wool chairs and one is used, it acts as if it were the number corresponding to its length ("ABC" would be 3, "Chair" would be 5, etc.)

Commands

Command Description Example
// A comment. Nothing happens.
//Comment //Does nothing.
Construct Initializes a variable (argument 2) of type specified by first argument. Automatically activates this chair.
Construct chair mychair
Sit Activates this chair. Skips if first argument is deconstructed.
Sit mychair
Value Set the value of the active chair to the first argument.
Sit mychair
Value 42
Copy Sets value of active chair to the value of the chair given in the first argument.
Sit mychair
Copy otherchair
Add Adds the first argument to the active chair. If the argument is wool and the active chair is a wool chair, the argument gets appended. If the argument is a number and the active chair is a number, it is normal addition. If the argument is a number and the active chair is a wool chair, it removes the first n letters, n being the argument.
Sit mychair
Add addchair
Sub The same as Add, except it subtracts. If active chair is wool chair and argument is number, it removes the last n letters, n being the argument.
Sit mychair
Sub subchair
Mult The same as Add, except it multiplies. If active chair is wool chair and argument is integer, it repeats the value n times, n being the argument.
Sit mychair
Mult multchair
Div The same as Add, except it divides.
Sit mychair
Div divchair
Exp Exponentializes the active chair by the first argument. Same behavior as Mult
Sit mychair
Exp expchair
Deconstruct Makes the chair given in the first argument deconstructed. A deconstructed chair cannot be sat on, nor modified. A chair that is not deconstructed, however, cannot be read, unless sat on. Humans, rocking chairs and wool cannot be deconstructed, and can always be read from.
Sit otherchair
Deconstruct mychair
Add mychair
Reconstruct mychair
Reconstruct Makes a chair no longer deconstructed.
Sit otherchair
Deconstruct mychair
Add mychair
Reconstruct mychair
Rock Flips the active chair's value. If the value is not 0, it becomes 0. Otherwise, it becomes 1.
Sit myrockingchair
Rock
Check, Checked and Routine end Check checks if the active chair is not equal to 0. If it is equal to 0, it won't execute any commands until it reaches its respective Routine end. The first argument of Check is the chair to check. Checked is used inside Checks to end the checkup and go to a Routine end. The argument for Checked is how many Checks to cancel. Routine end marks the end of a routine, a routine being a loop, an Automation, or a Check.
Set myrockingchair
Better mychair otherchair
Check myrockingchair
Set mywoolchair
Read
Set otherrockingchair
Deconstruct mywoolchair
Equal mywoolchair constantwoolchair
Check otherrockingchair
Checked 2
Routine end
Set constantwoolchair
Read
Routine end
Better If the first argument is greater than the second, the active chair's value will be 1. Otherwise, it will be 0.
Sit myrockingchair
Better mychair 8
Check myrockingchair
Set tempwoolchair
Value "Chair mychair is greater than 8"
Read
Routine end
Worse The opposite of Better.
Sit myrockingchair
Worse mychair 8
Check myrockingchair
Set tempwoolchair
Value "Chair mychair is less than 8"
Read
Routine end
Equal If both given arguments are equal, the active chair's value will be 1, otherwise 0.
Sit myrockingchair
Equal mychair 8
Check myrockingchair
Set tempwoolchair
Value "Chair mychair is exactly 8"
Read
Routine end
Read Prints the value of the active chair to the console.
Sit mywoolchair
Value "Hello, World!"
Read
Etch Asks for input. The inputted text gets converted to the type of the active chair.
Sit mywoolchair
Value "Please input age: "
Read
Sit mychair
Etch
Sit mywoolchair
Value "You are "
Sit otherwoolchair
Copy mychair
Sit anotherwoolchair
Value " years old."
Sit mywoolchair
Deconstruct otherwoolchair
Deconstruct anotherwoolchair
Add otherwoolchair
Add anotherwoolchair
Read
While, Finish and Loop While is a standard while loop, using the first argument as its condition. End with Routine end. Finish ends the loop completely, as if the condition was set to false and it would skip to the end of the loop. Loop restarts the loop.
Sit mychair
Value 8
Sit myrockingchair
Value 1
While myrockingchair
Reconstruct mywool
Sit mywool
Etch
Sit otherrockingchair
Deconstruct mywool
Equal mywool f
Check otherrockingchair
Finish
Routine end
Equal mywool l
Check otherrockingchair
Loop
Routine end
Reconstruct mychair
Sit mychair
Sub 1
Sit myrockingchair
Deconstruct mychair
Worse mychair 0
Routine end
Place Places the human in the first argument on the activated chair.
Sit mychair
Place myhuman
Sleep Waits n seconds, n being the value of the active chair.
Sit tempchair
Value 2
Sleep
Pack Saves the value of the active chair to a file, given by the first argument.
Sit tempwoolchair
Value "/path/to/file.txt"
Sit mywoolchair
Value "The quick brown fox jumps over the lazy fox."
Deconstruct tempwoolchair
Pack tempwoolchair
Unpack Reads from a file to the active chair. Filepath given by second argument.
Sit tempwoolchair
Value "/path/to/file.txt"
Sit mywoolchair
Deconstruct tempwoolchair
Unpack tempwoolchair
Read
Automate, Return and Call Define a function. Done as Automate FunctionName chair MyArgument chair OtherArgument. If an argument is a human, it reads and writes to that variable. Otherwise, it reads and writes to a temporary list of variables, that gets cleared after the function ends. A human named "ActivePointer" and a chair named "ActiveChair" both get added. Return returns its argument. Call calls the function in the first argument.
Automate Abs rockingchair min
Construct chair tempchair
Value -1
Construct rockingchar temprocker
Deconstruct ActiveChair
Worse ActiveChair 0
Reconstruct ActiveChair
Sit ActiveChair
Check temprocker
Mult tempchair
Routine end
Check min
Mult tempchair
Routine end
Return ActiveChair
Routine end

Construct chair mychair
Value -3
Call Abs 0
Read //prints 3
Value -7
Call Abs 1
Read //prints -7
Value 9
Call Abs 0
Read //prints 9
Value 4
Call Abs 1
Read //prints -4

Variable types

Type Name in code Description
Chair chair An integer.
Throne[note 1] throne A floating point number, also known as a float.
Rocking chair rockingchair A boolean. Either true (1) or false (0).
Wool wool A single character.
Wool chair[note 2] woolchair A string.
Human human Pointer. When using this in any command other than Place, it acts as if it were the chair.

Example Programs

Hello World

Construct woolchair printvalue Value "Hello, World!" Read

Quine

[note 3]

Construct woolchair pv
Value "Construct woolchair pv
Value "
Add "
Mult 2
Construct woolchair pt
Value "Add "
Add "
Construct woolchair val
Value "Value "
Add "
Construct woolchair mid
Value "
Mult 2
Construct woolchair pt
"
Construct woolchair end
Value "
Construct woolchair val
"
Construct woolchair end2
Value "
Construct woolchair mid
"
Construct woolchair cend
Value "
Construct woolchair end
"
Construct woolchair cend2
Value "
Construct woolchair end2
"
Construct woolchair cendc
Value "
Construct woolchair cend"
Construct woolchair cendf
Value "
Construct woolchair final
Deconstruct pv
Deconstruct pt
Deconstruct val
Deconstruct mid
Deconstruct end
Deconstruct end2
Deconstruct cend
Deconstruct cend2
Deconstruct cendc
Deconstruct cendf
Deconstruct cendw
Add pv
Add 

Add pt
Add mid
Add val
Add pt
Add 

Add pt
Add end
Add val
Add val
Add 

Add pt
Add end2
Add val
Add mid
Add qu
Add cend
Add val
Add end
Add qu
Add cend2
Add val
Add end2
Add qu
Add cendc
Add 

Add val
Add cend
Add qu
Add cendc
Add two
Add 

Add val
Add cend2
Add qu
Add cendc
Add c
Add 

Add val
Add cendc
Add qu
Add 

Add cendc
Add f
Add 

Add val
Add cendf
Add qu
Add

Add cendw
Add q
Add u
Add 

Add val
Add 

Add cendw
Add t
Add w
Add o
Add 

Add val
Sub 1
Add two
Add 

Add cendc
Add w
Add 

Add val
Add cendw
Add qu
Add 

Add cendf
Read"
Construct wool qu
Value "
Construct wool two
Value 2
Construct woolchair cendw
Value "
Construct wool "
Construct woolchair final
Deconstruct pv
Deconstruct pt
Deconstruct val
Deconstruct mid
Deconstruct end
Deconstruct end2
Deconstruct cend
Deconstruct cend2
Deconstruct cendc
Deconstruct cendf
Deconstruct cendw
Add pv
Add 

Add pt
Add mid
Add val
Add pt
Add 

Add pt
Add end
Add val
Add val
Add 

Add pt
Add end2
Add val
Add mid
Add qu
Add cend
Add val
Add end
Add qu
Add cend2
Add val
Add end2
Add qu
Add cendc
Add 

Add val
Add cend
Add qu
Add cendc
Add two
Add 

Add val
Add cend2
Add qu
Add cendc
Add c
Add 

Add val
Add cendc
Add qu
Add 

Add cendc
Add f
Add 

Add val
Add cendf
Add qu
Add

Add cendw
Add q
Add u
Add 

Add val
Add 

Add cendw
Add t
Add w
Add o
Add  

Add val
Sub 1
Add two
Add cendc
Add w
Add 

Add val
Add cendw
Add qu
Add 

Add cendf
Read

Truth machine

Construct woolchair zero
Value "0"
Construct woolchair one
Value "1"
Construct woolchair input
Deconstruct zero
Deconstruct one
Etch
Construct rockingchair iszero
Deconstruct input
Equal input zero
Check iszero
Reconstruct zero
Sit zero
Read
End routine
Sit iszero
Rock
Check iszero
Equal input one
Check iszero
Reconstruct one
Sit one
While iszero
Read
End routine //while
End routine //is one
End routine //isnt zero

References

  1. A throne is much more detailed than most other chairs, similar to how a float is much more detailed than an integer.
  2. This was intended as a pun, as I thought that wool was made out of string (for whatever reason.)
  3. This may not work. I have bad memory, but when I tested this by copying and pasting in Notepad, it worked. All I know for sure, is that this is very unoptimized.