We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Matcha

From Esolang
Jump to navigation Jump to search

Matcha is an esoteric programming language created by qvixnh22, yyyy7089, and hibye1217 in 2025. It is based on geometrical approach of uniqueness, with some flavors of tea.

How does the language works

Brewing a good Matcha program is not easy. So here is 4 easy (or hard) steps to brew a Matcha program.

Step 1. Brew some water (a.k.a. Preprocessing)

Before brewing some water, we need to check which lines we can make tea, so as to not wase any water.

We brew water only for the lines that contains exactly two integers. Every nondigit characters (except the - sign) are considered as a seperator.

This line does not contain any integers, so we don't brew any water in this line.
This line contains only 1 integer, so we don't brew any water in this line either.
However, line 3 contains 2 integers, so we brew some water in this line.
But line 4 contains 3 integers, which is more than 2, so we don't brew any water in this line.

Negative numbers such as -22 are also considered as an integer.

Here are some edge cases:
"0005" contains 1 integer: 5.
"7089-1217" contains 2 integers: 7089 and -1217.
"100--007" contains 2 integers: 100 and -7.
"123x456" contains 2 integers: 123 and 456.
"123 456" contains 2 integers: 123 and 456.
"123,456" contains 2 integers: 123 and 456.

Step 2. Pour over your tea (a.k.a. More Preprocessing)

After we brew the water, we pour the water onto the line. This makes the lines to have various flavors. There exists exactly 2 flavors, strong and weak.

The flavor of the line is determined as follow: Place a point in a 2-dimensional Euclidean space for each line that we brew water. The first number is the x coordinate, while the second number is the y coordinate.

The line have strong flavor if and only if there exists a 2-dimensional vector such that the dot product of the vector and the point is the maximum over the every point, and have weak flavor otherwise. The line does not have any flavor if we didn't brew any water in that line.

Since strong flavor is, well, strong, if there exists 3 strong flavored points in a straight line, then the program results in a compilation error.

(0, 1000) has strong flavor.
(500, 500) on the other hand, has weak flavor.
(0, 0) has strong flavor.
And so does (1000, 1000).
This line is comment, so this line does not have any flavor.
Neither (400, 400) ...
... nor (600, 600) have strong flavor.
But (1000, 0) have strong flavor.
Note that we can have same point like (500, 500) as long as there are no three strong flavored points in a line.

Step 3. Steep (a.k.a. Compiling)

After pouring the water, we need to steep. The time we need to steep each line depends on a flavor.

For each pair of consecutive lines, we steep the tea and record the taste as follow:

  • If at least one of the line does not have any flavor, we don't steep this pair and record nothing.
  • Otherwise, we steep based on how many lines have strong flavors. The more lines that have strong flavors, the longer we steep.
  • This results in a bitter taste if both lines have strong flavor, sweet taste if both lines have weak flavor, and mild taste otherwise.

We then divide the taste recording into pairs of result. If there were odd number of recording and therefore cannot evenly divide the recording, then the program results in a compilation error.

For example, the code on step 2 will result in a taste recording of MMBSMM (B for Bitter, M for Mild, and S for Sweet). This recording gets divided into pairs of result, resulting in MM, BS, MM.

  • Line 1 and Line 2 have strong and weak flavor. So we have mild taste for this pair.
  • Line 2 and Line 3 have weak and strong flavor. So we have another mild taste.
  • Line 3 and Line 4 both have strong flavor. So this pair have bitter taste.
  • Line 5 does not have any flavors, so we skip Line (4, 5) and Line (5, 6).
  • Line 6 and Line 7 both have weak flavor, resulting in sweet taste.
  • And Line (7, 8) and Line (8, 9) both result in mild taste.

Step 4. Adjust to your taste (a.k.a. Running)

This final step is where we finally gets to see the result of the Matcha program.

First, we prepare infinite number of teacups and line them in a row. Each teacup has unique integer index starting from negative infinity to positive infinity. The program also have the pouring machine which initially points at the cup number 0. Initially, every cup is empty.

Then the program looks at the divided recording (starting from the first one) and executes the following instruction, moving right.

BB See the amount of the tea in the cup the machine is pointing at, and print a character using ASCII code.
BM Take out 70 ml of tea in the cup the machine is pointing at.
BS Examine the amount of tea in the cup the machine is pointing at. If the amount is zero, jump to closest next SB. Otherwise, let the amount be k ml, and jump to k-th SB (start from beginning).
MB Add 89 ml of tea to the cup the machine is pointing at.
MM Move the pouring machine 12 cups to the left.
MS Get one character from user as an input, and set the amount of tea in the cup the machine is pointing at be the ASCII code of that character.
SB Allow some rest. Do nothing.
SM Move the pouring machine 17 cups to the right.
SS Examine the amount of tea in the cup the machine is pointing at. If the amount is zero, jump back to next to last executed BS.

Each cup can contain at most 264-1 ml of tea. To prevent the cups from overflowing, every calculation about the amount of the tea have to be performed under mod 264. This also means that removing 70 ml of tea from an empty cup results in pouring 264-70 ml of tea onto said tea.

The following are the Runtime Errors the machine can get:

  • BB cannot print an ASCII character because the amount was greater than 127 ml.
  • BS cannot jump to closest next SB as next SB does not exists.
  • Similarly, BS cannot jump to k-th SB as the number of SB is less than k.
  • SS cannot jump back to next to last executed BS as the machine didn't executed any BS before this.

Compiler Specification

The compiler must have the time complexity of O(N log N). After all, we cannot wait too long to brew some tea, right?

External Links