Eror
Hello, this is my third Esolang, Eror. I'm User:5anz. This Esolang is about making errors (known as erors here) intentionally, since there are no real control flow options (If this then that, Do this until this condition is met, etc.) other than EROR:. This Esolang is actually inspired by Javagony.
Syntax
Functions
There are a handful of functions, and, unlike my other (non-joke) Esolang (B i n a r y), it's easy to tell where the gap between two functions are... mainly because you need effort to really do that. There are 9 Functions.
Function | Parameters | Description |
---|---|---|
text | Prints the text (\" removes the \ and prints the "). | |
DEF | var = int | Defines a new variable (var) equal to the value of int. |
SET | var = int | Like DEF, but it redefines var instead. |
INPUT | var | Asks the user for input as a number, then SETs var to that number. |
PUSH | int | Pushes int onto the stack (heck yeah there's a stack!). |
POP | var | Pops a value off the stack and SETs var to that value. |
CYCLE | int | If int is positive, send the top value of the stack to the bottom int times, otherwise, do the opposite -int times. |
COMMENT | anything* | Does nothing, though writing a comment incorrectly can cause erors. |
EROR: | eror type | Whenever an eror occurs, goto this line, and the function doesn't end up happening. Nothing happens if this is hit naturally though*. Example, "EROR: DIVIDED BY ZERO" will get jumped to if you ever hit "PRINT 1 / 0". |
Note: "int" can mean a variable or mathematics, and "text" can mean an integer, mathematics, or even nothing (just PRINT on its own prints nothing, as used in the 99 bottles of beer program).
Note 2: You cannot directly take data from the stack, to print the top value of the stack, you'd have to do something like this...
DEF temp = 0 POP temp PRINT temp
and then to keep it you'd have to do this:
PUSH temp
Mathematics
You can do a few things with mathematics, and there's even priorities you have to do first (doing higher priorities first, left to right)… just look at the table.
Name | Code | Meaning | Priority |
---|---|---|---|
Concatenation | str1 <> str2 | Joins two strings together (So 'PRINT "Hello, " <> "World!"), and can even use a number (so '"My favourite number is " <> 12' would get to "My favourite number is 12". | 0 |
Addition | int1 + int2 | Add int1 and int2 together. | 1 |
Subtraction | int1 - int2 | Subtract int2 from int1. | 1 |
Multiplication | int1 * int2 | Multiply int1 and int2 together. | 2 |
Division | int1 / int2 | Divide int1 by int2 (prone to erors). | 2 |
Modulo | int1 % int2 | Division, but use the remainder instead. | 3 |
Brackets | ( int1 * int2 ) | Simply just adds priority to everything inside. | +4 per bracket (but don't use it on Concatenation, it has Priority 0 for a reason). |
The function its self would have a priority of -1 if you need to know. The gotoieness of the function -0.5.
Erors
There are... ALOT, of erors, more than there are functions and mathematics stuff, this is mainly because these are your ONLY form of control flow, again, No ifs, No loops, no... anything other than EROR:, You rely on dividing by zero, add number Just below 32767, functions like IF, WHEN, STOP, etc., etc.
This language isn't Turing complete due to a minor lack of erors, I'm sorry, I tried to delay being unable to make programs due to a lack of erors (you can see how desperate I was with ERROR)
To type an eror line, do this (Div by zero used as an example):
EROR: DIVIDED BY ZERO
Erors have been categorized, so go to Contents and look under "1.3 Erors"
Functions
Name | Functionality | Activation |
---|---|---|
FUNCTION DOES NOT EXIST | A function that doesn't exist has been used. | IF var = 0 |
WRONG PERAMETERS | The wrong parameters have been used for a function. | DEF "Hello, World!" |
WRONG CAPITALIZATION | Used lowercase where there should have been uppercase or vice versa | print STR |
Mathematics
NOT A NUMBER | Attempted to do mathematics with a string. | PRINT "str1" * "str2" |
CAN'T CONCATENATE | Tried to concatenate 2 integers. | PRINT 1 <> 2 |
OUT OF RANGE | A number has exceeded the 16-bit limit (between and including -32768 to 32767 | DEF var = 32768 |
DIVIDED BY ZERO | A classic, tried to divide by 0. | PRINT 1 / 0 |
DIVIDED INTO RATIONALITY | Tried to divide a number by a number that isn't divisible. | PRINT 3 / 2 |
MODDED BY ZERO | DIVIDED BY ZERO, but with modulo. | PRINT 1 % 0 |
TOO CLOSE | You didn't add spaces. | PRINT 3+2 |
TOO FAR | You added too many spaces. | Esolang won't let me add a bunch of spaces, use your imagination. |
NO SIGN | You were so focused on adding the correct number of spaces that you forgot to do an operation. | PRINT 3 2 |
NO NUMBER | You forgot to add a number. | PRINT 3 * + 2 |
SYMBOL UNDEFINED | You used a symbol that isn't defined. | PRINT 3 = 2 |
UNMATCHED BRACKETS | Their either isn't an equal amount of open and closed brackets, or a closed bracket comes before an opening bracket | COMMENT Both of these result in this eror.
PRINT ) 3 + 2 ( PRINT ( 3 + 2 |
UNMATCHED QUOTES | There are an odd number of quotation marks (excluding \" after an odd number of quotes | PRINT "Hello, world! |
Definitions & Redefinitions
VARIABLE NOT DEFINED | Tried to use/set a variable that hasn't been defined yet. | SET undef = 5
COMMENT We haven't defined undef yet. |
VARIABLE ALREADY DEFINED | Tried to define a variable that already exists. | DEF var = 0
DEF var = 1 |
CAN NOT DEFINE NUMBERS | Tried to define a number | DEF 5 = 12 |
THIS IS NOT FORTE | Tried to redefine a number... like Forte. | Set 5 = 12 |
NOTHING IS INVALID | Added an equals, but nothing after it. | SET var = |
WRONG INPUT | Your user typed either a string or an out of bounds number. | PRINT "What's the 13th letter on the keyboard?"
INPUT var COMMENT Hope this works. |
INVALID CHARACTERS | A variable uses character that isn't a lowercase letter or a number. | DEF vary_able = 6 |
DEFINED AN EQUATION | You tried to define an equation instead of a variable | DEF var1 + var2 = 3 |
SET AN EQUATION | You tried to redefine an equation instead of a variable | SET var1 + var2 = 3 |
Stack
STACK IS TOO LARGE | The stack has 256 items (I love this activation). | EROR: DIVIDED BY ZERO
PUSH 1 PRINT 1 / 0 |
STACK IS EMPTY | Tried to POP an empty stack. | COMMENT The stack is empty right now
POP var |
Comments
Remember what I said about your comments being written correctly?
Name | Functionality + Activation |
---|---|
IMPROPER GRAMMAR | COMMENT Your comment doesn't contain a full stop/period |
TOO LONG | COMMENT Your comment contains things after the full stop. To get around this, you can just use 2 commas, idk. |
TOO COMPLICATED | COMMENT Your comment contains an exclamation/question mark! |
Erors
These erors refer to other erors.
ERROR | You typed ERROR instead of EROR. | ERROR: DIVIDED BY ZERO |
EROR DOES NOT EXIST | The eror you have typed isn't in this list. | EROR: I LIKE ESOLANGS |
TOO MANY ERORS | Have multiple erors on the same line. | DEF var = 0
DEF var = 1 / 0 |
EROR NOT FOUND | Cause an eror without a corresponding eror line. | COMMENT Dividing by zero is over-used, just know that there's no "IMPROPER GRAMMAR" line |
EROR FOUND TOO MANY TIMES | Cause an eror with multiple corresponding eror lines. | IF var = 0
EROR: FUNCTION DOES NOT EXIST EROR: FUNCTION DOES NOT EXIST |
Note: If either of the last 2 meet their own condition, the program just ends.
Other note: erors with writing are prioritized over erors with... not writing (it's hard to explain without an example), so
PRINT 1/0
would result in a TOO CLOSE eror, even though you're dividing by 0.
Example Programs
Hello, World!
Not very interesting, this is in the group of esolangs where text is incredibly easy to print.
PRINT "Hello, World!"
Truth Machine
More interesting, since you can't do normal flow control
COMMENT Take input. DEF truth = 0 INPUT truth COMMENT Beginning of the loop. EROR: DIVIDED BY ZERO PRINT truth COMMENT Go to the beginning of the loop, if truth is 0, 1-0=1, 1/1=1, and if truth is 1, 1-1=0, and 1/0 is a divide by zero eror. DEF loop = 1 / ( 1 - truth )
99 bottles of beer
I like this one because of how I ended up doing it, being jumping into the middle of a loop.
DEF bottles = 99 COMMENT Define bottles, and start a new verse using this comment EROR: OUT OF RANGE PRINT bottles <> “ bottles of beer on the wall!” PRINT COMMENT Yes, you can do that. COMMENT Start a new verse. EROR: IMPROPER GRAMMAR PRINT bottles <> “ bottles of beer on the wall,” PRINT bottles <> “ bottles of beer!” PRINT “Take one down, pass it around,” COMMENT Decrements the number of bottles of beer on the wall. SET bottles = bottles – 1 COMMENT Checks if bottles is less than 2 and jumps back if it isn’t. DEF loop = bottles + 32766 COMMENT Now that we’re on the last set of things to print, there’s no reason we can’t just hardcode it. PRINT “1 bottle of beer on the wall!” PRINT PRINT “1 bottle of beer on the wall,” PRINT “1 bottle of beer!” PRINT “Take it down, pass it around,” PRINT “No more bottles of beer on the wall!”
Cat program
I'm not entirely sure if this counts, but this isn't very interesting.
DEF x = 0 INPUT x PRINT x
The reason I included this even though it isn't interesting was because what I am interested in is the
Exclusionary cat program
, which is basically just a cat program, but a certain input is excluded, in this case, 5.
COMMENT Beginning of a normal cat program. DEF x = 0 INPUT x COMMENT Results in a divide by 0 eror if x = 5. DEF exclude = 1 / ( x – 5 ) COMMENT There’s a large chance we divide into irrationality, so we add this to avoid that. EROR: DIVIDED INTO IRATIONALITY PRINT x
The best part is that we don't even need EROR: DIVIDED BY ZERO, because the lack of it and EROR: EROR NOT FOUND ends the program immediately!
Number guessing game
Due to the randomness, or, lack of it, in EROR, this is only fun the first time you've tried it, and if you haven't seen the code. In this case, it'll be hardcoded to 12.
DEF x = 0 DEF check = 0 PRINT “Give me a number!” COMMENT Set-up the program. This comment sends you to after you’re told if you’re too high or too low. EROR: OUT OF RANGE PRINT “Too high!” COMMENT Your number is greater than 12. Skip printing “Too low”. EROR: IMPROPER GRAMMAR PRINT “Too low!” COMMENT Your number isn’t greater than or equal to 12. Or in other words, it’s less than 12. COMMENT Invalid guess, tell the user to try again. EROR: WRONG INPUT PRINT “Invalid input, try again.” COMMENT Take another guess. EROR: TOO LONG INPUT x COMMENT Check if your number is too large. SET check = x + 32755 COMMENT Check if your number is 12. SET check = 1 / ( x - 12 ) EROR: DIVIDED INTO RATIONALITY COMMENT If you got this far, you number is neither 12, nor greater COMMENT Your number is 12. EROR: DIVIDED BY ZERO PRINT “Correct!”
The general process of changing it would be changing
SET check = x + 32755
in a way that if you changed your number to 18, you'd be add 6, so you subtract 6, in this case,
SET check = x + 32749
and you'd also change
SET check = 1 / ( x - 12 )
to be... do I need to say it?
SET check = 1 / ( x - 18 )
Factorial
The factorial is probably the only program that uses the stack, though, it doesn't use cycle.
COMMENT Define the number you want to factorialize. DEF x = 0 INPUT x COMMENT Push all the numbers between 1 and your input onto the stack. EROR: OUT OF RANGE PUSH x SET x = x – 1 DEF check = x + 32767 DEF factorial = 1 COMMENT Start the loop. EROR: ERROR COMMENT Multiply by the next number. POP x SET factorial = factorial * x COMMENT End the loop. EROR: STACK IS EMPTY ERROR: TOO LONG COMMENT Self explanatory. PRINT factorial
External Resources
Unfortunately, no interpreter has been made, but I'm working on one! I promise this won't end up like B i n a r y...
Proof this isn't Turing Complete
There's only one thing I have to say... there's limited erors. The problem is that you may need, say, fifty (though it's unlikely). And even worse, you only have two places to go after checking if something is equal, and only ONE place to check if something is greater/less than something else!