10 digits, 100 digytes

From Esolang
Jump to navigation Jump to search

10 digits, 100 digytes is a programming lnaguage designed by PSTF.

1 digyte is 10 digits, so its memory is very big. Programs are dumped in memory.

Command Set

Every cell is signed integer between -(1064) to 1064. But it supports infinity cell and variables.

Below 10(Basics)

0: NOP.
1: Read current memory cell.
2: Write value to current cell.
3: Variable define.
4: Variable modify.
5: Constant.
6: Halt.
7: Quit with value x.
8: Increase by 1.
9: Decrease by 1.

Symbol:

NOP
LOD
WRT x
DEF x, y, z    (Leave z blank to define blank variable, and leave y and z blank to define NULL variable, y is type)
MOV x, y
CNS x, y, z
HLT
QUI x
INC x
DEC x

10 ~ 29(Arithmetic, Bitwise, and Push/Pop)

10: Add two parameters together.
11: Subtract the two parameters.
12: Multiply two parameters together.
13: Divide the first parameter by the second one. If the second argument is zero, the program is immediately interrupted and terminated with 4 (output "How dare you divide by 0?!!").
14: Divide the first parameter by the second one, and return quotient. If the second argument is zero, the program is immediately interrupted and terminated with 4 (output "How dare you divide by 0?!!").
15: Divide the first parameter by the second one, and return remainder. If the second argument is zero, return the first parameter.
16: Multiply the first parameter by itself over and over again (the number of times is the second parameter). This is same as the exponent.
17: Bitwise AND. This command turn decimal to binary and then do bitwise operation.
18: Bitwise OR.
19: Bitwise NOT.
20: Bitwise XOR.
21: Push the value to the stack. If the top of the stack pointer is already pointing to the maximum space of the stack, and you still try to put a value into the stack, exit with a termination of 18 (the output "The stack is blown out!!!").
22: Pop the top of stack and store it into given address. If there are no elements in the stack (the top of the stack pointer points to the bottom of the stack) and you still try to pop an element, exit with a termination of 19 (the output is "The stack is empty, what are you going to dig for!").
23: Join the specified value to the buffer.
24: Pop the tail of the buffer and store it into given address.
25: Set the accumulator to the specified value.
26: Transfers the value of the accumulator to the specified address and resets the accumulator to 0.
27: Reset the variable/register/accumulator.
28: Clear the buffer.
29: Clear the stack.

Symbol:

ADD x, y or x + y
SUB x, y or x - y
MUL x, y or x * y
DIV x, y or x / y
IDV x, y or x // y
MOD x, y or x % y
EXP x, y or x ** y
AND x, y or x & y
OR x, y or x | y
NOT x or ~x
XOR x, y or x ^ y
PUSH x
POP x
JIN x
CUT x
PSA x
PPA x
RST x
CBF
CST

30 ~ 39(Conditional)

30: If statement.
31: Else statement.
32: Elif statement.
33: Endif.
34: Jump to specified label.
35: Jump to specified label if condition is true.
36: Jump to specified label if condition is false.
37: There is no command for this value.
38: There is no command for this value.
39: There is no command for this value.

Symbol:

IF cond
ELSE
ELIF cond
ENDIF
JMP x
JCT x
JCF x
...
...
...

40 ~ 49(Loops)

40: Start a conditional loop.
41: Generates an open interval with a minimum value of a, a maximum value of b and a step of c.
42: Start an iterative loop.
43: End of a loop.
44: Break out the loop.
45: Skip this round of loop.
46: Jump to the specified label if LR is not zero and then decrease LR by 1.
47: There is no command for this value.
48: There is no command for this value.
49: There is no command for this value.

Symbol:

WHILE cond
OIV a, b, c
FOR iter IN iter_containter
ENDLOOP
BRK
SKP
LOOP x
...
...
...

50 ~ 59(Function calls and Rec&Reg)

50: Definition of the function.
51: Let the function return a specific value. If there is no return value within the function, you do not need to specify the function type.
52: End of function definition.
53: Call a function.
54: Lambda expression.
55: There is no command for this value.
56: There is no command for this value.
57: There is no command for this value.
58: There is no command for this value.
59: There is no command for this value.

Symbol:

FUNCTION name type param_list
RETURN retval_list
ENDFUNC
CALL
LAMBDA
...
...
...
...
...

60 ~ 69(I/O)

60: Read a number and store it into specified address. If a decimal point appears in the input and the specified address is an integer variable or register, it is rounded. If something does not conform to the specified base system appears in the input, exit with 7th termination (output "What is this, can I eat it?"). If you input a Boolean variable, 0 is parsed as false and everything else is parsed as true.
61: Print the value of specified address.
62: Read a string and store it into specified address(read until EOL). If a numeric variable is entered, the number is parsed from it (if parsing fails, it exits with a 7th termination). If you enter a Table variable, the colon is found and parsed to a key-value pair (or a normal element if there is no colon).
63: Outputs the value of the specified address as Unicode characters. If it is a decimal, it is output after rounding to 0 (output after rounding the part of the integer). If it is a Boolean value, false corresponds to "F" and true corresponds to "T". If it is a string, it is output directly. If it is a table, it is also directly output.
64: Redirects the input to the specified file (including CON).
65: Redirects the output to the specified file (including CON). Note: If the second parameter is 0, the write permission is in append mode, otherwise it is in write-only mode.
66: There is no command for this value.
67: There is no command for this value.
68: There is no command for this value.
69: There is no command for this value.

Symbol:

IPT x
OUT x
REA x
WRT x
RDI x
RDO x, y
...
...
...
...

Example

Hello, world!

OUT "Hello, world!"
HLT
QUI

Dec dump:

DATA
00072 00101 00108 00108 00111 00032 00119 00111 00114 00108 00100 00000

A+B

DEF a, INT
DEF b, INT
IPT a
IPT b
OUT a + b

Categories and References

I still didn't thinked how to categorize this.