From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:6fd1:: with SMTP id x200mr34324908itb.26.1546458129599; Wed, 02 Jan 2019 11:42:09 -0800 (PST) X-Received: by 2002:a9d:6f9a:: with SMTP id h26mr929485otq.0.1546458129446; Wed, 02 Jan 2019 11:42:09 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!q69no73283itb.0!news-out.google.com!v141ni111ita.0!nntp.google.com!q69no73278itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 2 Jan 2019 11:42:09 -0800 (PST) In-Reply-To: <66f4b77c-bd72-4044-a9a5-48e1dc8d77a9@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.77.182.20; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.77.182.20 References: <30ba8954-a19e-4c95-b350-798b0276db41@googlegroups.com> <66f4b77c-bd72-4044-a9a5-48e1dc8d77a9@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada grammar rules for names too permissive? From: Stephen Leake Injection-Date: Wed, 02 Jan 2019 19:42:09 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55168 Date: 2019-01-02T11:42:09-08:00 List-Id: 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.