bug-marst
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MARST bug: no integer statement labels


From: Andrew Makhorin
Subject: Re: MARST bug: no integer statement labels
Date: Sun, 10 Aug 2003 20:51:03 +0400

>I believe this is a bug.  An unsigned integer should be a valid statement
>label according to section 3.5.1 of the "Modified Report."  Test program
>and compiler error follows.
>
>begin
>  switch S := 17, L2, L3;
>
>17:  outstring(1,"Label 1");
>L2:  outstring(1,"Label 2");
>L3:  outstring(1,"Label 3");
>  go to S[1]
>end
>
>marst testswitch.a60 
>
>testswitch.a60:4: invalid use unsigned integer `17' as a label
>testswitch.a60:8: one error detected on the first pass; translation 
>terminated

Unsigned integers as labels are allowed in the Revised Report, but in
the Modified Report this is not allowed. Only identifiers can be used
as labels (see the syntax definition in the section 3.5 "Designational
expressions" of the Modified Report).

The reason was to make the language more clear and simplify the
translator. For example, if you pass an unsigned integer as actual
parameter and there is a label which is the same unsigned integer (as
17 in your example), it is unclear what should be actually passed:
integer constant or label. If the specification of a procedure to be
called is not available, the translator should generate two versions
of the code: one to pass the constant and other to pass the label.


- Andrew Makhorin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]