comp.lang.ada
 help / color / mirror / Atom feed
* Ada95 BNF
@ 2001-05-03 12:23 Martin Dowie
  2001-05-03 16:24 ` Stephen Leake
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Dowie @ 2001-05-03 12:23 UTC (permalink / raw)


Looking through the BNF on AdaPower.com and the LRM that comes with
adaguide, I noticed
that package_unit_name is defined as a name, which in turn can be all sorts
of things,
including a 'name', which in turn can be lots of things - including a type
conversion?!

Shouldn't package_unit_name be defined as an Identifier?..





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-03 12:23 Ada95 BNF Martin Dowie
@ 2001-05-03 16:24 ` Stephen Leake
  2001-05-03 19:18   ` Martin Dowie
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Leake @ 2001-05-03 16:24 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@nospam.baesystems.com> writes:

> Looking through the BNF on AdaPower.com and the LRM that comes with
> adaguide, I noticed
> that package_unit_name is defined as a name, which in turn can be all sorts
> of things,
> including a 'name', which in turn can be lots of things - including a type
> conversion?!

Just because something is allowed by the syntax, doesn't mean it is
allowed by the language. See the appropriate LRM section for the real
rules. In this case, 'parent_unit_name' is first discussed in 10.1.1,
which doesn't actually help that much.

> Shouldn't package_unit_name be defined as an Identifier?..

A 'parent_unit_name' can be of the form ancestor.parent, which is not
an "identifier". So "name" is appropriate.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-03 16:24 ` Stephen Leake
@ 2001-05-03 19:18   ` Martin Dowie
  2001-05-04  9:27     ` Marius Amado Alves
  2001-05-08 14:53     ` Tucker Taft
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Dowie @ 2001-05-03 19:18 UTC (permalink / raw)


Ok... this seems a little strange to me - but if those are the rules! :-)

Is it really that hard to come up with a BNF that does actually match
what the language does allow?

"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:uk83yv1su.fsf@gsfc.nasa.gov...
> Just because something is allowed by the syntax, doesn't mean it is
> allowed by the language. See the appropriate LRM section for the real
> rules. In this case, 'parent_unit_name' is first discussed in 10.1.1,
> which doesn't actually help that much.
>
> > Shouldn't package_unit_name be defined as an Identifier?..
>
> A 'parent_unit_name' can be of the form ancestor.parent, which is not
> an "identifier". So "name" is appropriate.






^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
@ 2001-05-04  5:48 Christoph Grein
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Grein @ 2001-05-04  5:48 UTC (permalink / raw)
  To: comp.lang.ada

The Ada BNF reflects a bit the parsing sequence. If something resolves to a name 
in the syntax, the name resolution rules have to be applied. This involves 
overloading resolution and a lot of other things.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-03 19:18   ` Martin Dowie
@ 2001-05-04  9:27     ` Marius Amado Alves
  2001-05-08 14:53     ` Tucker Taft
  1 sibling, 0 replies; 8+ messages in thread
From: Marius Amado Alves @ 2001-05-04  9:27 UTC (permalink / raw)
  To: comp.lang.ada

> Is it really that hard to come up with a BNF that does actually match
> what the language does allow?

I thing that good thing happens with Pascal (I dont have the Report at
hand to be 100% sure).

-- 
Marius Amado Alves
 alves@systran.lu
Project Tradaut-Pt
Systran Luxembourg
12, Rue de Vianden
L-2680  LUXEMBOURG
Tel 352 + 45 46 53
Fax 352 + 45 74 75
Mob 351 +939354002





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-03 19:18   ` Martin Dowie
  2001-05-04  9:27     ` Marius Amado Alves
@ 2001-05-08 14:53     ` Tucker Taft
  2001-05-09  6:18       ` Martin Dowie
  1 sibling, 1 reply; 8+ messages in thread
From: Tucker Taft @ 2001-05-08 14:53 UTC (permalink / raw)


Martin Dowie wrote:
> 
> Ok... this seems a little strange to me - but if those are the rules! :-)
> 
> Is it really that hard to come up with a BNF that does actually match
> what the language does allow?

In many cases it is preferable to make the BNF somewhat
"looser" than the "official" grammar, and then do the
checking as part of semantic checking, because the errors
tend to be handled a bit more gracefully.  In addition,
in Ada, there are constructs which look identical
syntactically but which are distinct semantically, such
as a type conversion and an array indexing.  The grammar
in the LRM distinguishes these, whereas the grammar used
for an LR parser can't, since an LR parser requires that
the grammar be context-free (i.e. independent of the
"meaning" of particular identifiers).

-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom Corporation (A Titan Company) 
Burlington, MA  USA (AverCom was formerly the Commercial Division of AverStar:
http://www.averstar.com/services/ebusiness_applications.html)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-08 14:53     ` Tucker Taft
@ 2001-05-09  6:18       ` Martin Dowie
  2001-05-09 13:47         ` Ted Dennison
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Dowie @ 2001-05-09  6:18 UTC (permalink / raw)


Fair enough, but I still thnk it is strange that it
wasn't defined along the lines of:

defining_program_unit_name ::=
  [ parent_unit_name "." ] defining_identifier

parent_unit_name ::=
  identifier

given that "identifier" already exists and can be
navigated to through the existing definitions in
about 2 clicks and by-passing all the 'invalid'
options anyway...

:-)


Tucker Taft <stt@averstar.com> wrote in message
news:3AF80887.F8942BE3@averstar.com...
> Martin Dowie wrote:
> >
> > Ok... this seems a little strange to me - but if those are the rules!
:-)
> >
> > Is it really that hard to come up with a BNF that does actually match
> > what the language does allow?
>
> In many cases it is preferable to make the BNF somewhat
> "looser" than the "official" grammar, and then do the
> checking as part of semantic checking, because the errors
> tend to be handled a bit more gracefully.  In addition,
> in Ada, there are constructs which look identical
> syntactically but which are distinct semantically, such
> as a type conversion and an array indexing.  The grammar
> in the LRM distinguishes these, whereas the grammar used
> for an LR parser can't, since an LR parser requires that
> the grammar be context-free (i.e. independent of the
> "meaning" of particular identifiers).
>
> --
> -Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
> Chief Technology Officer, AverCom Corporation (A Titan Company)
> Burlington, MA  USA (AverCom was formerly the Commercial Division of
AverStar:
> http://www.averstar.com/services/ebusiness_applications.html)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Ada95 BNF
  2001-05-09  6:18       ` Martin Dowie
@ 2001-05-09 13:47         ` Ted Dennison
  0 siblings, 0 replies; 8+ messages in thread
From: Ted Dennison @ 2001-05-09 13:47 UTC (permalink / raw)


In article <3af8ded6$1@pull.gecm.com>, Martin Dowie says...
>
>Fair enough, but I still thnk it is strange that it
>wasn't defined along the lines of:
>
>defining_program_unit_name ::=
>  [ parent_unit_name "." ] defining_identifier
>
>parent_unit_name ::=
>  identifier
>
>given that "identifier" already exists and can be
>navigated to through the existing definitions in
>about 2 clicks and by-passing all the 'invalid'
>options anyway...
>
>:-)
>
>
>Tucker Taft <stt@averstar.com> wrote in message
>news:3AF80887.F8942BE3@averstar.com...
>> Martin Dowie wrote:
>> >
>> > Ok... this seems a little strange to me - but if those are the rules!
>:-)
>> >
>> > Is it really that hard to come up with a BNF that does actually match
>> > what the language does allow?
>>
>> In many cases it is preferable to make the BNF somewhat
>> "looser" than the "official" grammar, and then do the
>> checking as part of semantic checking, because the errors
>> tend to be handled a bit more gracefully.  In addition,
>> in Ada, there are constructs which look identical
>> syntactically but which are distinct semantically, such
>> as a type conversion and an array indexing.  The grammar
>> in the LRM distinguishes these, whereas the grammar used
>> for an LR parser can't, since an LR parser requires that
>> the grammar be context-free (i.e. independent of the
>> "meaning" of particular identifiers).
>>
>> --
>> -Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
>> Chief Technology Officer, AverCom Corporation (A Titan Company)
>> Burlington, MA  USA (AverCom was formerly the Commercial Division of
>AverStar:
>> http://www.averstar.com/services/ebusiness_applications.html)
>
>

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-05-09 13:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-03 12:23 Ada95 BNF Martin Dowie
2001-05-03 16:24 ` Stephen Leake
2001-05-03 19:18   ` Martin Dowie
2001-05-04  9:27     ` Marius Amado Alves
2001-05-08 14:53     ` Tucker Taft
2001-05-09  6:18       ` Martin Dowie
2001-05-09 13:47         ` Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2001-05-04  5:48 Christoph Grein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox