comp.lang.ada
 help / color / mirror / Atom feed
From: Optikos <optikos@verizon.net>
Subject: Re: Ada to Ada Translator ?
Date: Wed, 22 May 2019 09:34:37 -0700 (PDT)
Date: 2019-05-22T09:34:37-07:00	[thread overview]
Message-ID: <29eb5a31-64d0-45f3-8c2e-7a715ac8f02d@googlegroups.com> (raw)
In-Reply-To: <430790a7-7d0b-4812-b40a-d781cd1dd62d@googlegroups.com>

On Wednesday, May 22, 2019 at 10:24:10 AM UTC-5, Shark8 wrote:
> On Wednesday, May 22, 2019 at 6:57:05 AM UTC-6, foo wong wrote:
> > Just to stick with the topic I brought up earlier, if nested subprograms were translated into more
> > primitive Ada code, then the translator would translate any library code. The only grammar that is
> > required is for core Ada.
> What is the use-case of the "nested subprograms" example? I just don't get it... 

Spark8, please consider the following cascading ramifications.  Why do you think that the ARG has killed off nested subprograms, lambdas, and closures?

The implementation of named nested subprograms facilitates the implementation of unnamed nested subprograms (i.e., lambdas).  The implementation of lambdas facilitates the the implementation of closures.  Closures facilitate functional programming.  Functional programming facilitates correctness proofs.  Having another mechanism for Ada correctness proofs than SPARK facilitates the rise of a true competitor to GNAT+SPARK.  The rise of a true competitor to GNAT+SPARK facilitates the rise of a true direct competitor to AdaCore as a company.  Therefore, rewind:  nip named & unnamed nested subprograms in the bud.

Btw, this cascading-ramification sequence over in C++land could permit the rise of a C++ correctness prover (done all wobbly on shaky C foundations, but still it also could be at least •marketed• as a SPARK+GNAT competitor, even if it isn't as good).

> plus, capturing the
> context of those subprograms might be a bit more complex than you're thinking: if they use local
> variables, the the realization might be better as a GENERIC subprogram with those very objects as
> formal parameters.

As much as I loathe their usage of the C++ template engine as a poor-man's functional programming language with atrocious syntax, Boost C++ libraries can serve as inspiration for how to implement lambdas and closures in the Ada-to-Ada code generator, especially in older Boost libraries targeting older C++ compilers that lack C++11-&-onward language support for lambdas and closures.

> > Based on this website:
> > https://wiki.osdev.org/Ada_Bare_bones
> > 
> > These are the parts that the translator would need to translate into more primitive Ada code:
> > 
> > """
> > 
> > pragma Discard_Names;
> > pragma Restrictions (No_Enumeration_Maps);
> > pragma Normalize_Scalars;
> > pragma Restrictions (No_Exception_Propagation);
> > pragma Restrictions (No_Finalization);
> > pragma Restrictions (No_Tasking);
> > pragma Restrictions (No_Protected_Types);
> > pragma Restrictions (No_Delay);
> > pragma Restrictions (No_Recursion);
> > pragma Restrictions (No_Allocators);
> > pragma Restrictions (No_Dispatch);
> > pragma Restrictions (No_Implicit_Dynamic_Code);
> > pragma Restrictions (No_Secondary_Stack);
> > """
> > 
> > but even some of these could be skipped over. If I am the one that ends up doing this, I will only be
> > focused on hardware embedded Ada and I will focus on new targets and not every last corner-case
> > feature
> ??
> 
> Forgive me, but I don't see how these restriction pragmas dovetail into an Ada-Ada translator... at all.
> Could you explain how you see them doing so?

Patrick is proposing that his Ada-to-Ada code generator would accept all valid GNAT source code.  As such as GNAT-wrapper, it would need to at least parse & accept GNAT extensions so as to pass them through verbatim (and/or modified slightly if they interfere with the not-pass-through portions of the Ada-to-Ada code generator).

What would be really cool would be for the Ada-to-Ada code generator to accept Digital Ada's extensions too, especially a.app, which would permit multistage programming in a compile-time Ada interpreter as a rather direct competitor to MetaOCaml.


  reply	other threads:[~2019-05-22 16:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 14:21 Ada to Ada Translator ? foo wong
2019-05-17 21:00 ` Simon Wright
2019-05-18 12:05   ` foo wong
2019-05-18 12:11     ` foo wong
2019-05-18 14:47     ` Simon Wright
2019-05-18 15:26       ` foo wong
2019-05-18 16:48         ` Simon Wright
2019-05-19 16:04         ` G.B.
2019-05-19 17:08           ` Simon Wright
2019-05-19 18:27             ` Optikos
2019-05-19 21:27               ` Simon Wright
2019-05-19 21:42               ` Simon Wright
2019-05-21 20:54                 ` Optikos
2019-05-22  6:59                   ` Simon Wright
2019-05-22 12:06                     ` Optikos
2019-05-22 12:33                       ` Simon Wright
2019-05-22 12:57                         ` foo wong
2019-05-22 15:24                           ` Shark8
2019-05-22 16:34                             ` Optikos [this message]
2019-05-22 20:07                               ` Randy Brukardt
2019-05-23  7:21                           ` G. B.
2019-05-22 13:33                         ` Optikos
2019-05-20 14:11         ` Optikos
2019-05-20 16:37           ` foo wong
2019-05-18 15:44       ` foo wong
2019-05-18 16:49         ` Simon Wright
2019-05-19 15:04         ` G.B.
2019-05-19 12:41 ` Optikos
2019-05-19 17:38   ` foo wong
2019-05-19 22:52   ` foo wong
2019-05-20 23:19   ` Randy Brukardt
2019-05-21  0:13     ` Optikos
2019-05-21 22:15       ` Randy Brukardt
2019-05-22  0:16         ` Optikos
2019-05-22 20:16           ` Randy Brukardt
2019-05-22 23:27             ` foo wong
2019-05-23  7:56               ` Simon Wright
2019-05-23 12:29                 ` foo wong
2019-05-21 22:20       ` Randy Brukardt
2019-05-21  0:17     ` Optikos
2019-05-22 18:49 ` Optikos
replies disabled

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