思
思 is designed by PSTF.
Language Overview
PSTF: "I'll compile and run every script myself."
Syntax
This Esolang is based on memory, and stack, and even the STDIN and STDOUT.
I'll directly store data to the memory.
I also have 10 special registers:
- All input and output, mathematical operations, logical operations, and bit operations are carried out in the "Kernel".
- Use "Find" to get the address of a certain data.
- Others just as normal storer.
I can also control STDIN and STDOUT, even variables, and even object-oriented.
Commands
Basics
| CMD | Meaning |
|---|---|
0 <id> |
Reset the "id". |
<data>=> <id> |
Set "id" to "data". |
<data>+> <id> |
Add "data" to "id". |
<data>-> <id> |
Subtract "data" from "id". |
<id1> (=) <id2> |
Swap "id1" and "id2". |
input |
Get user input and store it to kernel. |
print <x> |
Print x. |
<id> = ker? |
If "id" equals to kernel, then put 1 to REG01, otherwise 0. |
<id>-> ker |
Reset "id" and add the original value of "id" to kernel. |
<data>*> <id> |
Multiply "id" by "data". |
<data>/> <id> |
Divide "id" by "data". |
label :name{code} |
Define a label. |
ker? $name |
If kernel is not 0, then jump to label "name". |
# |
I'll ignore that line if it's started with hashtag. |
NOP |
Do nothing. |
|<X>| |
I'll stop. |
If you can, please don't let me execute the command that defines the tag and the tag jump, which will break the script.
Advanced
Conditions
if (expr)
{
code1
}
(
else if (expr)
{
code2
}
else if (expr)
{
code3
}
...
else
{
coden
}
)
I know that "(expr)" is to determine if the value of expr is true.
Loop
loop if (expr)
{
code
}
Variable
<varname>(: <type>, <const?>) = <value>
I'll read BubbleLang to get that type.
Memory
When the data of a memory cell exceeds 9223372036854775807, if you ask me to add 1 to it, I will smash the cell and replace it with a new empty cell.
Of course, if you ask me to subtract 1 from an empty cell, this will definitely fail, so I will do NOP.
Example
Hello, world!
print "Hello, world!"
One time Cat
input print ker
Disan count
input
a = ker
i = 1
if (a = 0)
{
|<X>|
}
loop if (i < a)
{
if (i % 2 == 0)
{
print f"{i} is even"
}
else
{
print f"{i} is odd"
}
}