1nteger
Hello I make Esolang that is have am got 1 integer. 1integer. 1nteger. 1teger. Ok actually I went too far with that I like the 2nd last one.
It's been a while since I EXISTED here so I may describe things differenter. -5anz (talk)
Synatx and stuff
Idk what to say here other that just what you can/can't do.
Variables kind of thing idk actually.
There are 3 weird things I don't actually know what to call
| Name | Function |
|---|---|
| int | The actual variable. |
| inp | If found on a line, it takes input as a character. All instances of inp are the same ((inp + 5) * inp will take input once and always equal x2+5x where x is the input.)
|
| rnd | inp, but instead of taking input, it's a random number between 0 and 255. |
Mathematics
Maths stuff are run highest priority to lowest priority, and left to right in case of ties.
| Operation | Priority | Function |
|---|---|---|
| + | 0 | Add the 2 numbers either side of it. |
| - | 0 | Subtract the 2 numbers. |
| * | 1 | Multiply. |
| / | 1 | Integer division (so 7/2=3, not 3.5). |
| % | 1 | Modulo (the remainder from division). |
| ^ | 2 | Expontentiation. |
| ( | N/A | Add 3 to the priority of the operations to the right. |
| ) | N/A | (, but subtract 3 instead. |
Logic
Half of the functions use this. Priority from maths is here again, but maths will ALWAYS come before logic.
| Operation | Priority | Function |
|---|---|---|
| = 0 | inf | True if the number to the left is 0. |
| > 0 | inf | True if the number to the left is strictly positive (not 0) |
| not | 1 | True if the Boolean to the right is false. |
| and | 0 | True if the Booleans to the left and right are true. |
| or | 0 | False if the Booleans to the left and right are false. |
| [ | N/A | (, but it's 2, and also only applies to logic. |
| ] | N/A | You can probably guess this one based on [ and ). |
Functions
Every line must start with one of the following, along with their given parameters. Most of these are flow control because there's nothing to really do with 1 variable other than redefine it. Also I'm not too sure how to describe anything other than PNT and SET.
| Function | Parameters | What it does |
|---|---|---|
| PNT | Number | Converts the number into base 256, and printed (So 72 => H, and 18537 => Hi).
|
| SET | Number | Sets int to the number. |
| IF | Boolean | If True, run the code below, and then skip to the corresponding END line among hitting a corresponding ELIF/ELSE/END line. If False, skip to the next corresponding ELIF/ELSE/END line. |
| ELIF | Boolean | Basically just IF again. |
| ELSE | None | Just continue with the code. Exists for the sake of IF/ELIF/ELSE statements |
| WHILE | Boolean | If False, Jump to the corresponding END line. Otherwise, continue with the code |
| END | None | If this belongs to a WHILE statement, check if the WHILE line's variable is true, if so, jump back to the WHILE line. |
Examples
Yeah they're just examples.
Hello, World!
There are 2 ways to print text in this program, being character by character...
PNT 72 PNT 101 PNT 108 PNT 108 PNT 111 PNT 44 PNT 32 PNT 87 PNT 111 PNT 114 PNT 108 PNT 100 PNT 33
...and whatever you call THIS.
PNT 5735816763073854918203775149089
I will be using the 2nd one because who cares that much about printing text.
print("Hello, World!")
I actually use the 2nd one in 2 ways here.
PNT 609405906361962024721765196896447782698668464597427933545008837628210146069084911673
Cat Program
This uses the 2nd one to print text instead of taking input, then printing, even though that would've been way simpler. Also yes, I'm calling it that.
SET inp
WHILE int % 256 > 0
SET int * 256 + inp
END
PNT int / 256
Also, whitespace, besides newlines, does nothing here, you could easily replace the 3rd line with SETint*256+inp and nothing would change.
99 bottles of beer
SET 99
WHILE int > 0
PNT int / 10 + 48
PNT int % 10 + 48
PNT 223509695441771403721694050335917529073735799623250134588000958967196682
PNT int / 10 + 48
PNT int % 10 + 48
PNT 1276014788466720137451338822211301029377106100139999190092191236222023627069506805836654835135733426008705462012488714
SET int - 1
PNT int / 10 + 48
PNT int % 10 + 48
PNT 57218482033093479352753676885994887442876364703552034454528245495601629706
END
Number Guessing Game
Admittedly could've let = 0 and > 0 just be = and >, but oh well, someone may have already coded stuff and it would be too late. Unlikely, but still.
SET rnd * 256 + inp
WHILE int % 257 > 0
IF int / 256 - int % 256 > 0
PNT 6084203806649710369
ELSE
PNT 1557556174485044291617
END
SET int / 256 * 256
END
TC proof
The following is a TbS that would act as a Polyglot with this language. Technically it's 30000 cell brainfuck, but it's pretty easy to change it to, like, grahams number or whatever.
| brainfuck | 1nteger |
|---|---|
| + | SET int + 30000 * 256 ^ (int % 30000)
|
| - | SET int - 30000 * 256 ^ (int % 30000)
|
| > | SET int + 1
|
| < | SET int - 1
|
| . | PRT int / (30000 * 256 ^ (int % 30000)) % 256
|
| , | SET int - ((int / (30000 * 256 ^ (int % 30000)) % 256) - inp) * 30000 * 256 ^ (int % 30000)
|
| [ | WHILE int / (30000 * 256 ^ (int % 30000)) % 256 > 0
|
| ] | END
|