Re: buggy 4.0 program
- Posted by DerekParnell (admin) Dec 11, 2008
- 1682 views
Matt & Igor: How about: Missing reference: Variable 'a'
Bernie, the problem seems to be more serious than just new wording of the error message. See please the screenshot of the next even more simple programm b.e:

and outputs of 1.0 - 3.1.1:
and 4.0:
Igor, please let me explain why the v3 message is different to the v4 message.
In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.
v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed. Instead, it assumes that a reference to an unknown identifier is valid and continues with the parsing effort. In this case, it finds two adjacent identifiers at the begining of a statement, namely "a" and "puts". However, the only things that can come legally after an identifier at the begining of a statement is one of the assignment operations, a left-parethensis, or a left-square bracket. Certainly one cannot have two adjacent identifiers. So in that context, the v4 message "Syntax error - expecting to see ..." is sensible.
Also, in v4, if there are syntax errors, it doesn't go on to tell you about possible 'missing' identifiers - because it maybe that certain syntax errors cause identifiers to go missing, e.g.
---- integer a() a = 1 ----
It is not much use reporting that the declaration is invalid and reporting that the 'a' is missing.
Note how I used some creole tags in this reply to make it easier to write and read.