Error Codes and Causes
ZWL is a new language and getting used to it may take some hours of coding. This document will help you understanding and fixing parse errors so that you won't feel stuck at a problem.
While coding in Outomated IDE, code is auto parsed time to time and parse errors are shown together with highlighting the code that failed. Sometimes the errors may be easy enough to fix but at times they may sound cryptic. Following lists most common parse errors and their most common cause with fix.
#
Token recognition errorA symbol is not recognized by ZWL.
Check whether there is an invalid character and fix it. For instance, if you place ;
or @
, parser flags them as invalid.
#
Mismatched input 'xx' expecting 'yy'A token/symbol is either at wrong place, is an extra or is missing
Check whether you've put a symbol at a wrong place, given an extra or missing it completely.
#
When a symbol is missingprint(length('Hello World')
Notice the lack of closing parenthesis in the end. If you dry run it, the parser produces the following error:
mismatched input '<EOF>' expecting ')' - 1:28
The error says, parser was expecting a closing parenthesis, but got an 'end of file' character. To fix the error, simply put the missing parenthesis in the end of the statement.
#
When there is an extra symbolIf you've put an extra symbol, parser will report it in following way:
a = ((3 + 2) * 7) * (8/7))
Parser tells:
mismatched input ')' expecting <EOF> - 1:26
This means parser was expecting an end of file but found
)
symbol. Removing the extra)
from the end solves the problem.#
When symbol is at wrong placeIf you've used a symbol at wrong place where another symbol was expected, parser reports it in following way:
a = { name = 'hifi'}
Parser tells:
mismatched input '=' expecting ':' - 2:12
This means parser was expecting a
:
but found=
.
#
No viable alternative at input 'xx'Given code statement is not defined in language
Check whether you're using a syntax or operation that is not supported by ZWL. See below example:
a+= 1
Notice the use of a non supported syntax in ZWL. If you dry run it, the parser produces the following error:
no viable alternative at input 'a+' - 1:2
The error says, parser couldn't find any language rules that can be used to match the given input. To fix, use a supported syntax such as ++
.