(j3.2006) resolving grammar ambiguities
Bill Long
longb
Mon Oct 19 19:13:05 EDT 2009
Van Snyder wrote:
> On Sat, 2009-10-17 at 00:56 -0700, Robert Corbett wrote:
>> One of the members of Sun's Fortran team has been reviewing
>> the Fortran 2008 draft. I have been able to answer most of
>> the questions he has raised, but tonight he raised one for
>> which I could not find an answer.
>>
>> Consider syntax rule R737 on page 158. It is
>>
>> data-target is variable
>> or expr
>>
>> The syntax rule for variable is rule R602 on page 117.
>> It is
>>
>> variable is designator
>> or expr
>>
>> Thus, expr can be generated from data-target in two ways
>>
>> data-target -> expr
>>
>> and
>>
>> data-target -> variable -> expr
>>
>> If the second derivation is used, data-target is subject
>> to constraint C724, but if the first definition is used,
>> it is not.
>
> I don't think there is a problem with the constraints, since C602
> requires <expr> to be a reference to a function that returns a pointer.
And the corresponding C726 requires that <expr> be a reference to a
function that returns a data pointer. Not quite a match. If C602 said
"data pointer" instead of just "pointer", then the <expr> part of
<data-target> could be cleanly dropped, as C726 would be redundant.
Cheers,
Bill
>
> The "or expr" part of R737 is unnecessary, but harmless, since the
> second derivation arrives at the same syntax, with the constraint that
> <expr> is a reference to a function that returns a pointer. Applying
> C724 to the second derivation just says "<variable> has to have the
> POINTER attribute" and then C602 says "and by the way, <expr> has to be
> a reference to a function that returns a pointer." It doesn't hurt
> anything to say it twice.
>
>> I could find no explanation of how such ambiguities should
>> be resolved.
>>
>> Bob Corbett
>> _______________________________________________
>> J3 mailing list
>> J3 at j3-fortran.org
>> http://j3-fortran.org/mailman/listinfo/j3
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the J3
mailing list