(j3.2006) resolving grammar ambiguities

Bill Long longb
Sat Oct 17 17:55:31 EDT 2009



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

Do you mean that a data-target can be generated from an expr in two ways..


> 
>      data-target  ->  expr

This one, from R737, is OK, since expr is properly constrained.

> 
> and
> 
>      data-target  ->  variable  ->  expr

This one seems problematic. For R602, the restriction on expr is only 
that it be a function reference with a pointer result (not a data 
pointer result).  Thus, it would appear that this chain would allow a 
data-target to be  procedure pointer - clearly not the intention.

Either:

1) C724 should restrict variable to be a designator, or

2) C602 should be limit the function to one that returns a data pointer 
(in which case, the "expr" option in R737 is unnecessary, can be 
dropped, and your ambiguity is eliminated).

Since variable is defined in the Clause entitled Use of DATA objects, I 
suspect we intended (2).

Cheers,
Bill



> 
> If the second derivation is used, data-target is subject
> to constraint C724, but if the first definition is used,
> it is not.
> 
> 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

-- 
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