Copyright © 2024 Sebastiaan Heins
An error is a problem that occurs when the program is running.
There are two types of errors: syntax errors and runtime errors.
Syntax errors are caught before the code is ran, these can not be catched by the user.
Runtime errors are caught while the code is running, these can be catched by the user.
And uncaught error will cause the program to safely exit.
The exit code then is set to the error code.
In most cases a helpful error message is printed to the console, also showing where the error occured.
When no error occured, the program will always exit with exit code 0.
If the program crashes without printing an error message, it is most likely a bug and should be reported.
If the error location is wrong or the error message is not correct, it is most likely a bug and should be reported.
If a number literal is invalid, throw this error.
Theres are a few examples of invalid number literals:
- 1.
- 1.0.0
do say (1.) // 1. is an invalid number literal
If a char literal is invalid, throw this error.
Theres are a few examples of invalid char literals:
- 'a
- 'ab'
do say ('Hello') // char literal must only have 1 char
If a string literal is not closed, throw this error.
Theres are a few examples of unclosed string literals:
- "Hello
- "Hello\"
do say ("Hello) // string literal must be closed
A master keyword MUST be at the beginning of each line of code.
do, set, make, define, import, include, return, continue, break, switch, const
say ("Hello") // Error, line doesn't start with a master keyword
The line seperator character '' is missing.
do say ("Hello") // Error, missing seperator
A closing parenthesis ')', '}' or ']' is missing.
do say ("Hello" // Error, missing closing parenthesis
An opening parenthesis '(', '{' or '[' is missing.
An unexpected token was found.
An identifier was expected.
define void () {} // expected identifier
A type identifier was expected.
make a = 0 // expected type identifier