(j3.2006) resolving grammar ambiguities
Van Snyder
Van.Snyder
Mon Oct 19 15:42:18 EDT 2009
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.
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
More information about the J3
mailing list