INF: VALUE Is a Reserved Word
PSS ID Number: Q11077
Article last modified on 12-09-1992
PSS database name: S_PasCal

3.13 3.20 3.3x

MS-DOS


Question:

What is wrong with the following Pascal program?

    program pem(input,output,em,errors);
    type
      idclass=  (types,konst,qvars,stcnst,field,carrbnd,proc,func);
      where=    (blck,rec,wrec);
      nameinfo=record
        CASE OCCUR:where of
          REC: (linker: integer);
        end;

        identifier=record
          CASE KLASS:idclass of
     KONST  : (value  :  integer);
        end;
    begin
    end.

Response:

The only change necessary is to rename your variable "value" because
"value" is a reserved word (see Page 373 of the "Microsoft Pascal
Version 3.32 Reference" manual, in Appendix E, "Summary of Microsoft
Pascal Reserved Words"). 

The error messages that you receive when you run PAS1 are confusing.
Here is a summary of the process used in debugging your program: 

If you examine the line that causes the error for anomalies, the first
thing to check is the syntax of a similar (successful) piece of code.

There is an example in the manual of a very similar piece of code. On
Page 79 of the Pascal Version 3.32 reference manual, in Section 7.3.1,
"Variant Records", the example of the record "FOO" is very similar.
After consulting this example, the only obvious difference is that
there are no semicolons at the end of the line preceding the end
statement. That should not create these errors, however, and indeed
changing that does not do anything. 

Because the format of the line is correct, you have to look for
something else. The variable "value" is a possible cause of error
because it is a general name that might be used by the compiler for
something else. Looking in the appendix concerning Pascal reserved
words, you will find VALUE. Changing VALUE to a non-reserved word
results in successful compilation. 

Copyright Microsoft Corporation 1992.