comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Ada grammar rules for names too permissive?
Date: Wed, 2 Jan 2019 11:42:09 -0800 (PST)
Date: 2019-01-02T11:42:09-08:00	[thread overview]
Message-ID: <ba6e8468-dca0-435e-afe7-b36d3152ca4c@googlegroups.com> (raw)
In-Reply-To: <66f4b77c-bd72-4044-a9a5-48e1dc8d77a9@googlegroups.com>

On Tuesday, January 1, 2019 at 1:03:34 PM UTC-8, oliverm...@gmail.com wrote:
> On Tuesday, January 1, 2019 at 9:06:59 PM UTC+1, Stephen Leake wrote:
> > > [...]
> > 
> > This is precisely why I use a generalized LR parser for Emacs Ada mode; I don't have to mess with the published grammar. It works very well in practice.
> 
> Hmm... I downloaded org.emacs.ada-mode-6.0.1.tar.bz2, is that what you are 
talking about?

Yes. It's also a GNU ELPA package.

> In there, I see a file ada.wy which seems to be an Ada grammar, is that what you are talking about?

Yes. 

> What do you do with 12.3 :
> 
> explicit_generic_actual_parameter ::= expression | (variable_)name
> | (subprogram_)name | (entry_)name | subtype_mark
> | (package_instance_)name

I eliminated it, along with generic_actual_part, because "name ( generic_actual_part ) " is a subset of "name ( actual_parameter_part )". That's what the comment at "generic_instantiation" is trying to say.

So ada.wy accepts a larger language than LRM Annex P; that's part of the strategy for handling incorrect syntax.

Perhaps "minimal changes" is not a correct description for this kind of change, but the changes I made only allow more choices for each token, they don't change the basic structure of the productions.

> If I leave away the italics I get:
> 
> explicit_generic_actual_parameter ::= expression | name
> | name | name | subtype_mark
> | name
> 
> So.. it seems I can answer my own question about solidifying the italics;
> that's what should be done, otherwise we get nonsense.

It's not nonsense, it's just redundant, and an indication that the legality should be checked by the post-parsing phases. ada.wy deals with such redundancies by including only the minimal set that covers the original.

There are still redundancies (listed in the %conflict declarations); those are handled at runtime by the generalized parser.

      reply	other threads:[~2019-01-02 19:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-29 18:20 Ada grammar rules for names too permissive? olivermkellogg
2018-12-31 21:45 ` Randy Brukardt
2019-01-01  8:44   ` Dmitry A. Kazakov
2019-01-01 19:49     ` Stephen Leake
2019-01-01 20:42       ` Dmitry A. Kazakov
2019-01-02 19:21         ` Stephen Leake
2019-01-02 20:47           ` Dmitry A. Kazakov
2019-01-03 21:45             ` Stephen Leake
2019-01-03 22:34               ` Jere
2019-01-05 18:46                 ` Stephen Leake
2019-01-07 11:11                   ` J-P. Rosen
2019-01-08 18:58                     ` Stephen Leake
2019-01-04  8:53               ` Dmitry A. Kazakov
2019-01-03 22:39     ` olivermkellogg
2019-01-04  8:58       ` Dmitry A. Kazakov
2019-01-05  8:45         ` Randy Brukardt
2019-01-05 18:50       ` Stephen Leake
2019-01-01 19:46   ` olivermkellogg
2019-01-03 22:36     ` Randy Brukardt
2019-01-01 19:46 ` Stephen Leake
2019-01-01 21:03   ` olivermkellogg
2019-01-02 19:42     ` Stephen Leake [this message]
replies disabled

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