James Giles writes:
> The syntax rules involving <scalar-xyz> are not
> explicitly specified, but are "assumed syntax rules".
But those assumed rules are explicit. See 1.6.3, which defines them
(explicitly) and gives the answer.
> Do you
> interpret this name as subobjects of scalar constants (in which
> case, your example is illegal: they are subobjects an array constant),
> or as scalar subobjects of a constant (in which case your example
> is legal)? It is hard to tell the intent of the standard document here.
It is scalar subobjects of a constant. The rule for <scalar-xyz>
includes the constraint that xyz shall be a constant. In this case,
xzy is <constant-subobject>; it is not <constant>. There is no
other way to get to <scalar-constant-subobject>. Yes, one can
define a <scalar-constant>, but you can't then turn that into
<scalar-constant-subobject> because there is no syntax rule that
allows that. There is not, for example, an assumed rule for
<xyz-subobject>; if there were, then I'd agree that the construction
was ambiguous, but there isn't.
Uh oh! I think I just found the reason you find an ambiguity, though.
It's because there is a missing bnf definition in f95 (or anyway, I
can't find it - perhaps it is in one of the corrigenda, which I didn't
check). There should be a definition for <constant-subobject>. Then
you could apply the <scalar-xyz> rule to it. But I don't see that
definition for <constant-subobject>. There is one in f2k, but I
don't see it in f95.
So for f2k, I see the answer as "clear". For f95, unless I just
didn't find it, the missing definition for <constant-subobject>
does introduce ambiguity. I would take the f2k definition as
showing the intent here, but that's my personal opinion.
> This suffers from the same ambiguity as the first part of the first
> example. Is this repeat count a <scalar-int-constant-subobject>?
> It's a subobject of a constant no doubt. But the constant it's a
> subobject of is not a scalar. Again, how do you interpret the
> name of the syntax token <scalar-int-constant-subobject>? Must it
> be a integer subobject of a <scalar-constant>? Or must it be an
> integer subobject that is a itself a scalar?
Again, f2k has a bnf definition for <int-constant-subobject>, which
becomes the xyz in the <scalar-xyz> rule. For f95, it is more
arguable.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|