Upon considering the first operand design (see posts starting on
July 8, 2010), There still be some confusion with the reported error message and the token at which it is pointing. Consider this simple statement (and the error produced currently):
Z$ = A$ + B$ > C$
^-- expected string expression
This does not make sense, because first, the
integer expression is valid. The error occurs because this integer expression cannot be assigned to a string variable. And it could be confusing because a
string expression cannot be placed where the greater than operator is. Alternatively it could indicate that a string operator is expected at the greater than (later why this was ruled out). The previously proposed
first operand design would produce this error:
Z$ = A$ + B$ > C$
^^-- expected string expression
The error is now pointing to the beginning of the integer expression. But, one could say
wait a minute,
A$+B$ is a string expression, why is this an error? A better solution would produce this error:
Z$ = A$ + B$ > C$
^^^^^^^^^^^^-- expected string expression
This is much better as it highlights the entire expression, an integer expression, and says that a string expression is expected here. This can be accomplished by, in addition to keeping track of the first operand (the
A$), also keeping track of the last operand (the
C$). The error would point to all tokens between the first and the last of the invalid expression. Now, how can these two tokens be passed back where currently only one token is being returned when an error occurs? Next, the solution to this...
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)