Eror

From Esolang
Jump to navigation Jump to search

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 Commands.

Functions
Function Parameters Description
PRINT 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.

Mathematics
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 lowercase 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. 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

Definitions & Redefinitions

Note: From now on, I'm going to type semicolons whenever I need to add a new line, so

DEF input = 0
INPUT input
PRINT input

becomes

DEF input = 0; INPUT input; PRINT input
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.

We're going back to what we did earlier.
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 off the last 2 meet their own condition, the program just ends.

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 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!

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...

A reminder

At the bottom of every Esolang wiki page, there are tags mentioning several tings, for example: Stack-based, Unimplemented, all of them have Languages, but this one has "Unknown computational class", if anyone knows the name for... not Turing Complete (it's not Turing Incomplete), either tell me, or edit the categories so it's correct (unless it IS unknown computational class, in which just tell me), remember I said that this isn't Turing complete in Erors (1.3), because you have limited labels (aka eror lines), so you can't get in too many not-so-infinite loops.