Next: , Previous: , Up: Error Messages   [Contents][Index]


9.1.1 Parser Errors

If something goes wrong during compilation of your statements because you typed something that LUX does not understand, then by default LUX tries to indicate in detail what it is confused about and where it found the confusing code, by displaying a parser message. For example, if you type the command FOR DO, then LUX complains, because do is a reserved keyword so it cannot be the name of an identifier, and yet LUX expects an identifier after for. The complete message is:

parse error, expecting `COMMON_IDENTIFIER' in line 1: "for do"
(main): 1: Error just before ""
Illegal statement

This message explains what kind of input LUX was expecting (see below), what line (and, if necessary, what file) the offending code is in, the offending code itself, perhaps some additional information about which bit exactly caused confusion, and finally a verdict about the error ("Illegal statement", in this case).

The next example shows the error message generated by the command X=SIN(3 (i.e., with the closing parenthesis missing):

parse error, expecting `error' or `','' or `')'' in line 3: "x=sin(3"
(main): 3: Error just before end of line
Unbalanced ()

The kinds of things that a parse error message can list as being expected include single characters, such as the comma or closing parenthesis in the previous example (don’t mind the confusing quotes around them), particular kinds of expressions such as common_identifier (any valid name for a variable that starts with a letter) or special_identifier (any valid name for a global variable that starts with one character from $ ! #), or the curious item error, which you can ignore.


Next: , Previous: , Up: Error Messages   [Contents][Index]