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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Interesting article on ARG work Date: Tue, 10 Apr 2018 10:17:56 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1b44444f-c1b3-414e-84fb-8798961487c3@googlegroups.com> <62ee0aac-49da-4925-b9aa-a16695b3fc45@googlegroups.com> <9879872e-c18a-4667-afe5-41ce0f54559f@googlegroups.com> <80db2d05-744f-4201-ba1b-4436f8040491@googlegroups.com> <59f9ab6d-d6ba-45ff-a6f0-c5699983d9e8@googlegroups.com> <1a390e22-f49f-4028-8e58-ca4d0f51e4b6@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:51430 Date: 2018-04-10T10:17:56+02:00 List-Id: On 09/04/2018 22:24, Randy Brukardt wrote: > Dmitry A. Kazakov" wrote in message > news:pag4fd$pn4$1@gioia.aioe.org... >> On 2018-04-09 18:12, Niklas Holsti wrote: >> >>> For example, the text >>> >>> if Foo then >>> Bar; >>> @ else >>> @ Baz; >>> end if; >>> >>> would be parsed in four ways, according to the four combinations of >>> choices (enabled/disabled) for the two @ signs: >> >> [...] >> >> It is a trivial recursive-descent parser. "else" cannot follow "@", >> because there is no statement starting with "else". Full stop. > > Of course, that would very much emasulate the feature (probably 25% of the > @-code in Janus/Ada is to remove various "elsif" and "else" cases). > [Remember, we designed this code to work on very small memory hosts, so > anything not critical to the operation of the compiler is removed. One > reason that I don't use that any more in production code.] > > Another common use that you wouldn't allow is to remove the exception > handler from some code. (For Janus/Ada, the existence of an exception > handler has a cost, so if it is not needed for production code, it is best > completely eliminated.) I think both cases would be happily handled by optimization: if ... then ... else @ Something end if; Since @ Something becomes null, else null; is removed by the optimizer. The same would happen with exception when ... => @ Something [raise;] > I think you could come up with a rule that would be less harmful to the > feature than requiring full statements, especially for composite statements > like if and case and blocks. Maybe, but that would require more pages to explain in the RM (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de