Syntax errors¶
Because of the very simple syntax there are very few syntax errors. Even conditionals and loops are created with the methods invoking so syntax errors are possible to occur where the tokens does not match in a proper way.
How to handle syntax errors?¶
In Plezuro there are no fatal errors. Each error is an exception. When a script containing a syntax error is imported, it should throw an exception. A compiler should create an output script (or a function in a script where the scripts are joint altogether in the output) which throws an exception.
Total list of syntax errors¶
| Name | Occurrence | Examples |
|---|---|---|
| BracketStackException | a bracket is not closed, closing of another type of bracket, abundant bracket closing |
(2 + 3 (3 + 1 + [)] 4 + 5) |
| NonExistentTokenException | a token of not existing type | $αβγ = 21 |
| OperatorAfterBracketCloseException | neither operator nor another bracket closing after bracket closing | $x=[2] “oo” |
| OperatorAfterBracketOpenException | not proper operator after bracket opening or begin of a script | * 43 |
| OperatorAfterOperatorException | an operator after another one (although there are exceptions) | 2 + * 5 |
| OperatorBeforeBracketCloseException | an operator before bracket closing | (2 + 3 -) |
| ValueAfterValueException | a constant token after another one | 3 + * |