* Newbie question (Range Specifiers)
@ 1996-06-19 0:00 Sandeep V. Kharkar
1996-06-20 0:00 ` Sandeep V. Kharkar
1996-06-20 0:00 ` Kevin J. Weise
0 siblings, 2 replies; 4+ messages in thread
From: Sandeep V. Kharkar @ 1996-06-19 0:00 UTC (permalink / raw)
Hi,
I've recently started studying the Ada95 language.
First experience with Ada...
In the book I found a grammer rule for range specifiers
which goes
range_spec ::= name ' range ( static_expression )
but I found no examples of the use of this grammer rule.
What is this syntax used for ??
I figure that the [name'range] means the range
of the variable name. But what interpretation does the
braketed static expression have on the range ??
--
~Sandeep
skharkar@vzcorp.com
http://www.cs.usu.edu/students/SandeepKharkar/index.html
"To know recursion you must first know recursion !!"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Newbie question (Range Specifiers)
1996-06-19 0:00 Newbie question (Range Specifiers) Sandeep V. Kharkar
1996-06-20 0:00 ` Sandeep V. Kharkar
@ 1996-06-20 0:00 ` Kevin J. Weise
1996-06-21 0:00 ` Keith Thompson
1 sibling, 1 reply; 4+ messages in thread
From: Kevin J. Weise @ 1996-06-20 0:00 UTC (permalink / raw)
"Sandeep V. Kharkar" <skharkar@vzcorp.com> wrote:
>Hi,
>
> I've recently started studying the Ada95 language.
> First experience with Ada...
>
> In the book I found a grammer rule for range specifiers
> which goes
>
> range_spec ::= name ' range ( static_expression )
>
> but I found no examples of the use of this grammer rule.
>
> What is this syntax used for ??
>
> I figure that the [name'range] means the range
> of the variable name. But what interpretation does the
> braketed static expression have on the range ??
>--
I've been in this business long enough that the region in my brain previously
occupied by the Ada83 LRM has been recovered and filled with application-specific
trivia; there isn't enough room left to memorize the Ada95 LRM. But in a brief scan
of the Ada95 RM (principally in Annex P, the Syntax Summary and the Syntax Cross
Reference), I couldn't find the nonterminals or the production you specified above.
Can you please come back with a specific reference (i.e., document, section, page
number, whatever) where you found this beastie? I'd love to dig into it & find the
answer myself.
----------------------------------------------------------------------------------
Kevin J. Weise kweise@c3i-ccmail.sed.redstone.army.mil
COLSA Corporation voice: (205) 842-9680
Huntsville, AL
Serving the U.S. Army Missile Command, Software Engineering Directorate
standard disclaimers apply...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Newbie question (Range Specifiers)
1996-06-19 0:00 Newbie question (Range Specifiers) Sandeep V. Kharkar
@ 1996-06-20 0:00 ` Sandeep V. Kharkar
1996-06-20 0:00 ` Kevin J. Weise
1 sibling, 0 replies; 4+ messages in thread
From: Sandeep V. Kharkar @ 1996-06-20 0:00 UTC (permalink / raw)
Sandeep V. Kharkar (I Myself) wrote:
> RE :: grammer rule -->
> range_spec ::= name ' range ( static_expression )
> but I found no examples of the use of this grammer rule.
> What is this syntax used for ??
In response I got two mail replies...
For the sake of completeness here's
a summary of the replies...
This is related to multidimensional arrays.
The argument between brackets specifies which
dimension is concerned.
EXAMPLE ::
A : array (1..2, 1..5) of integer;
A'range(2) = 1..5
Similarly the attributes 'FIRST, 'LAST and
'LENGTH also have subscripted versions
for use with multi-dimensional arrays.
My ThanX to Mark Biggar and Laurent Gasser.
--
~Sandeep
skharkar@vzcorp.com
http://www.cs.usu.edu/students/SandeepKharkar/index.html
"To know recursion you must first know recursion !!"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Newbie question (Range Specifiers)
1996-06-20 0:00 ` Kevin J. Weise
@ 1996-06-21 0:00 ` Keith Thompson
0 siblings, 0 replies; 4+ messages in thread
From: Keith Thompson @ 1996-06-21 0:00 UTC (permalink / raw)
In <4qbvma$ajd@michp1.redstone.army.mil> "Kevin J. Weise" <kweise@c3i-ccmail.sed.redstone.army.mil> writes:
> "Sandeep V. Kharkar" <skharkar@vzcorp.com> wrote:
[...]
> > In the book I found a grammer rule for range specifiers
> > which goes
> >
> > range_spec ::= name ' range ( static_expression )
> >
> > but I found no examples of the use of this grammer rule.
> >
> > What is this syntax used for ??
[...]
> I've been in this business long enough that the region in my brain
> previously occupied by the Ada83 LRM has been recovered and filled with
> application-specific trivia; there isn't enough room left to memorize
> the Ada95 LRM. But in a brief scan of the Ada95 RM (principally in
> Annex P, the Syntax Summary and the Syntax Cross Reference), I couldn't
> find the nonterminals or the production you specified above. Can you
> please come back with a specific reference (i.e., document, section,
> page number, whatever) where you found this beastie? I'd love to dig
> into it & find the answer myself.
It's in section 4.1.4 of Annex P:
4.1.4:
range_attribute_reference ::= prefix'range_attribute_designator
4.1.4:
range_attribute_designator ::= Range[(static_expression)]
The static_expression, if present, specifies which dimension of an array
the range attribute refers to. For example, given the declarations
type Matrix is array(Positive range <>, Positive range <>) of Float;
M: Matrix(1 .. 10, 1 .. 20);
M'Range(1) is 1 .. 10, and M'Range(2) is 1 .. 20. The same applies to
the 'First, 'Last, and 'Length attributes.
See also the definition of the 'Range attribute in Annex K.
This was defined slightly differently in Ada 83, but with essentially
the same effect.
--
Keith Thompson (The_Other_Keith) kst@thomsoft.com <*>
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
"As the most participatory form of mass speech yet developed, the Internet
deserves the highest protection from government intrusion." -- ACLU v. Reno
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-06-21 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-19 0:00 Newbie question (Range Specifiers) Sandeep V. Kharkar
1996-06-20 0:00 ` Sandeep V. Kharkar
1996-06-20 0:00 ` Kevin J. Weise
1996-06-21 0:00 ` Keith Thompson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox