Project

General

Profile

Support #530

Interpreter error message: "for" with missing "do"

Added by Anna Maria Bigatti about 10 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Parser/Interpreter
Target version:
Start date:
09 Apr 2014
Due date:
% Done:

100%

Estimated time:
1.01 h
Spent time:

Description

Why do we get different error messages?

/**/ for i := 1 to 10 3;
ERROR: I was expecting "Do" but I've found "3" 
for i := 1 to 10 3;
                 ^
/**/ for i := 1 to 10 x;
ERROR: Unexpected identifier, are you forgetting a "*" or a ";" ?
for i := 1 to 10 x;
                 ^


Related issues

Related to CoCoA-5 - Feature #673: Error message: I was expecting...Closed2015-03-11

History

#1 Updated by John Abbott over 4 years ago

Oh, that is strange.
I suppose the parser thinks that 10 x is more likely a typo for 10*x, but that 10 3 is probably not a typo for 10^3.

It might be pretty hard to fix this one sensibly, i.e. so that it gives a better message with 10 x.

Here is another test

for i:=1 to 10* do

This gives "Invalid start of expression", and then indicate the keyword "do" as the position of the error.

#2 Updated by John Abbott about 2 years ago

  • Target version changed from CoCoA-5.?.? to CoCoA-5.4.0

Is it really worth investing effort trying to fix this?
The err mesgs are inconsistent but nevertheless useful to the user (I think).

Reject?

#3 Updated by Anna Maria Bigatti about 2 years ago

  • Status changed from New to Rejected
  • % Done changed from 0 to 100
  • Estimated time set to 1.01 h

Thinking about it, this just follows our human expectation for "x".
If we had

/**/ for i := 1 to 10 N
--> ERROR: Unexpected identifier; are you forgetting a "*" or a ";" ?

then the error message is much more plausible.

Although strange that two different error messages are given, they are equally good. Moreover, it would be quite hard to find how trying to fix them (and also, to do what??).
So, after discussing and testing, we decided to reject this issue.

Also available in: Atom PDF