Sōap

From Esolang
Jump to navigation Jump to search
Not to be confused with SOAP.
This is still a work in progress. It may be changed in the future.

Sōap (pronounced /soʊp/) or sooap is a esoteric language made by kiken. It is based around the text at the back of the container of the liquid soaps. (yes, I made many trips to the bathroom to see my soap for this)

Overview

Titles

Sōap consists of different titles. Titles consist of the following:

  • Ingredients
  • Warning
  • Directions for use
  • [the name of your soap]

[the name of your soap]

This title can be anything and any text below it describes the program. The text is ignored and does not affect execution, though all titles are required.

Ingredients

This title comes after the [the name of your soap] title. It specifies the variables that will be used in the script. All variables must begin with a capital letter and the list must end with a period. Example:

. . .

Ingredients:
H, E, L, O, Comma, W, R, D.

. . .

Directions for use

This title comes third in the script and usually takes up the bulk of he entire program. Here, only variables mentioned in the previous title may be used.

In cases where statements precedes a comma or is in the middle of a sentences, the statement must be lowercased.

Instructions:

Command Function
Turn the pump and press. Comes at the beginning of the program under this title
The <varName> should <action> your hands clean. Preforms <action> on varName
If the eyes come into contact with <expression>, <functionName> immediately with clean water. Preforms <functionName> if <expression> is 0.
Avoid contact with eyes. Prints the grabbed variable as ASCII
Try and avoid contact with eyes. Gets user input and stores it into the grabbed var as a string
<varName> is <expression>, Grabs the variable as well as setting it to <expression>
Grab <varName>, Grabs the variable
Keep doing [ <code> ] until <expression>. Repeat until <code> returns a falsy value (0) or <expression returns a falsy value
<statement>, then return <expression>. Returns <expression>. To be only used in functions or loops.
<functionName>, [ <code> ] Creates a function
soap. NOP

Warning

The Warning title comes at the end of a Sōap script. This determines the last command that will be executed. If there is no last command to be executed, do:

Avoid contact with eyes. Keep away from stainless steel.

Else, use the commands from the Directions for use section and end with the above.

Unlike the other titles, the Warning title ends with an exclamation mark, not a colon. I/O is disabled in this title.

Actions

There are different actions to be used in the second command listed in the Directions for use section. The actions are as following:

  • rinse - sets the variable to 0
  • wet - decrements the variable
  • dry - increments the variable

Expressions

Numbers

Numbers can be expressed by a chemical name. By default, chemical named are defined as 0 and can be increased in number by using prefixes sperated by hyphens. Example:

peroxide

The above returns 0. Another example:

hydrogen-peroxide

That returns 1.

Arithmetic

Arithmetic operations can be done like this:

the op of expression/varName and expression/varName

op can be as follows:

  • sum
  • difference
  • quotient
  • product

Strings

Strings in Sōap are just a list of chars (numbers). You can push, pop and access items from a list.

To access a list:

the number of <varName>

To declare a list, you just push an item onto an existing variable and it becomes a list and stays like that.

To push:

Add some varName/expression onto varName.

To pop:

Remove the object from varName.

Examples

Truth machine

Truth-machine Soap:
This soap will determine whether your hands are clean or not, and will clean them anyways.

Ingredients:
Serum, Bottle, Zero, One.

Directions for use:
Turn the the pump and press. Zero is glucose. One is monosodium-glutamate. Grab Serum, try and avoid contact with eyes. Clean, [ grab Zero, avoid contact with eyes. ] Shower, [ keep doing [ Grab One, avoid contact with eyes. ] until hydrogen-peroxide. ] Bottle is the hydrogen-peroxide of Serum. If the eyes come into contact with Bottle, clean immediately with clean water. The Bottle should wet your hands clean.

Warning!
If the eyes come into contact with Bottle, shower immediately with clean water.
Avoid contact with eyes. Keep away from stainless steel.

Hello, world!

The Hello World Soap:
This Hello World Soap will cleanse your hands and leave a nice Hello World smell on them.

Ingredients:
H, E, L, O, Space, W, R, D.

Directions for use:
Turn the pump and press. H is the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methyl-dehydrated-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide, E is the difference of the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methyl-dehydrated-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and chloride-dihydrogen-monoxide, L is the sum of the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methyl-dehydrated-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and sodium-chloride-dihydrogen-monoxide, O is the sum of the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methyl-dehydrated-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and dehydrated-hydrated-dehydrated-sodium-chloride-dihydrogen-monoxide, Space is the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and monosodium-sodium-chloride-dihydrogen-monoxide, W is the product of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and hydrated-dehydrated-hydrated-methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide, R is the difference of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and hydrated-dehydrated-hydrated-methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide, D is the difference of methyl-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and methyl-dehydrated-hydrocloride-methylphenidate-monoglutamate-monosodium-sodium-chloride-dihydrogen-monoxide and monosodium-sodium-chloride-dihydrogen-monoxide, soap. Grab H, avoid contact with eyes. Grab E, avoid contact with eyes. Grab L, avoid contact with eyes. Grab L, avoid contact with eyes. Grab O, avoid contact with eyes. Grab Space, avoid contact with eyes. Grab W, avoid contact with eyes. Grab O, avoid contact with eyes. Grab R, avoid contact with eyes. Grab L, avoid contact with eyes. Grab D, avoid contact with eyes.

Warning!
Avoid contact with eyes. Keep away from stainless steel.

Computational class

I suspect Sōap is turing-complete as it can simulate a Turing machine with at least three unbounded registers (three variables or a three-char string).

Implementations

There is a currently unfinished implementation at my implementations page, though the warning section is unimplemented and only two commands are implemented.