comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: Studying and Maintaining GNAT, Is There Any Interest in a New Group?
Date: Mon, 27 Aug 2018 08:42:07 -0700 (PDT)
Date: 2018-08-27T08:42:07-07:00	[thread overview]
Message-ID: <a82206e5-969f-4e27-8eff-8c0bfb889e56@googlegroups.com> (raw)
In-Reply-To: <64d7d54b-40fd-4090-b772-1402cce09dc4@googlegroups.com>

On Monday, August 27, 2018 at 9:46:22 AM UTC-5, Lucretia wrote:
> On Monday, 27 August 2018 03:38:32 UTC+1, Dan'l Miller  wrote:
> 
> > > There is no quibbling, I was pointing out his error in what he thought was what.
> > 
> > No, I was the one at the risk of quibbling by pointing out that GNAT has this weird not-truly-front-end,
> > not-truly-back-end 3rd layer called GIGI tree transducer to convert between the two (i.e., Ada versus
> > C/C++) semantic trees, where the Ada semantic tree is in the Ada-language-source-code front-end
> > and the C/C++ semantic tree is in the C-language-source-code back-end of GNAT.
> > 
> > My main point is:  I suspect that (except for brand new revisions of the Ada _LRM_) most bugs are not
> > in the GNAT true-•front•-end in Ada-language source-code nor in the GNAT true-•back•-end in C
> > language source-code shared with the rest of GCC.  I suspect that the vast majority of lingering
> > compiler bugs in GNAT have their root cause in less-than-perfect tree-transduction from Ada semantic
> > tree to C/C++-GENERIC/GIMPLE semantic tree, due in turn to having blinders on or tunnel vision, not
> > looking at enough context in the large.
> 
> You don't seem to understand how compilers or GCC is structured. There is no weird 3rd layer.
> 
> Compilers use multiple intermediate representations starting with an asbstract syntax tree, the passes
> take in the AST and modify it or create a new tree/IR until it gets to the point where code generation can
> take place. That's essentially it
> 
> Source Language -> Front-end -> AST -> IR -> IR -> .. -> IR -> Codegen -> Assembly code -> Assembler -> Machine code -> Linker -> Executable

And there is where you made your mistake.  That is in fact the bland non-innovative straight-from-the-textbook layering for C/C++ in GCC and many other languages' compilers.

Instead for GNAT the correction to your diagram looks like this:

Ada source Language -> Ada front-end written in Ada -> AdaAST from raw syntax repeatedly repeatedly repeatedly repeatedly traversed to adorn the AdaAST with Ada semantic adornments -> ••C/C++ semantic tree•• -> IR -> IR -> … -> IR -> Codegen -> Assembly code -> Assembler -> Machine code -> Linker -> Executable or DLL

What is peculiar to GNAT is tree transduction from Ada semantics to C/C++ semantics.  This was Dewar's & RMS's (& Schonberg's?) et. al.'s clever trick in 1993 to make Ada compatible with GCC's pre-existing design:  transduce the Ada front-end's semantics tree into the C/C++ •front•-end's C/C++ semantics tree (after, via repeated repeated repeated repeated traversals, preserving the •tree• structure for representing semantics instead of most prior Ada compilers' semantics-DAG, because tree-to-tree transduction is difficult enough, whereas DAG-to-tree transduction is much more impractical).

As I said at the outset, the very nature of this discussion risks accusations of quibbling what is and is not so-called IR in the so-called back-end.  ('Tis funny that you discounted the existence of the risk of quibbling over where the boundary between front-end & back-end precisely falls in GCC and then launched full-throttle right into that predicted quibbling.)  Personally, for the GCC C/C++ compiler, I place the authoring of the C/C++ semantic tree in the front-end, not the back-end, because, well, C/C++ semantics is a property of C/C++ language standardization.  GNAT has a clever rear-of-(Ada-)front-end-to-rear-of(-C/C++)-front-end transduction that is not commonplace in most other compilers.

All of your diagram's stages are to incrementally •lower• layers.  GNAT has—in addition to all that—a •lateral• transduction to the output of another language's (C/C++'s) •front•-end.  Even if you insist on quibbling that the authoring of the C/C++ semantics tree is in the back-end in GCC's C/C++ compiler, GNAT has an additional semantic-tree-to-semantic-tree transduction that is absent in GCC's C/C++ compiler.  GCC's C/C++ compiler has exactly one semantics-tree, not two, regardless of whether one categorizes it as front-end or back-end.

> Why use 1 word when 50 will do, right? 

Because in as little as one word, you get it factually incorrect.  Then it requires a well-worded progression of higher thought to untangle & dissect the incorrectness lucidly for all readers to understand the finer points imbued throughout the correction.

  reply	other threads:[~2018-08-27 15:42 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-25 12:27 Studying and Maintaining GNAT, Is There Any Interest in a New Group? patrick
2018-08-25 13:56 ` Dan'l Miller
2018-08-25 16:00   ` patrick
2018-08-25 16:16 ` Luke A. Guest
2018-08-25 17:42   ` patrick
2018-08-25 19:25     ` Simon Wright
2018-08-25 20:24       ` patrick
2018-08-25 21:48         ` Luke A. Guest
2018-08-25 21:53           ` patrick
2018-08-25 22:05             ` Luke A. Guest
2018-08-26 19:54           ` Dan'l Miller
2018-08-26 20:14             ` Dan'l Miller
2018-08-26 22:52             ` Lucretia
2018-08-27  2:38               ` Dan'l Miller
2018-08-27 14:46                 ` Lucretia
2018-08-27 15:42                   ` Dan'l Miller [this message]
2018-08-27 21:27               ` Randy Brukardt
2018-08-28  7:26                 ` Dmitry A. Kazakov
2018-08-29  0:16                   ` Randy Brukardt
2018-08-29  8:20                     ` Dmitry A. Kazakov
2018-08-29 21:43                       ` Randy Brukardt
2018-08-30  7:55                         ` Dmitry A. Kazakov
2018-08-30 23:25                           ` Randy Brukardt
2018-08-31  8:48                             ` Dmitry A. Kazakov
2018-08-31 22:42                               ` Randy Brukardt
2018-09-02  8:02                                 ` Dmitry A. Kazakov
2018-09-04 22:18                                   ` Randy Brukardt
2018-08-29  3:02                 ` Paul Rubin
2018-08-29  6:18                   ` Luke A. Guest
2018-08-29 19:00                     ` Paul Rubin
2018-08-30  5:54                       ` Luke A. Guest
2018-08-30  6:29                         ` Paul Rubin
2018-08-27 21:18             ` Randy Brukardt
2018-08-27  9:37           ` Simon Wright
2018-08-27 16:54             ` Bill Findlay
2018-08-27 17:42               ` Shark8
2018-08-31 21:23                 ` Robert A Duff
2018-08-31 22:51                   ` Randy Brukardt
2018-09-01 19:42                     ` Robert A Duff
2018-09-02  8:04                       ` Dmitry A. Kazakov
2018-09-02 10:11                     ` AdaMagica
2018-09-02 12:10                       ` Jeffrey R. Carter
2018-09-02 14:30                         ` AdaMagica
2018-09-04 22:05                           ` Randy Brukardt
2018-09-01  7:41               ` Simon Wright
2018-09-01 17:27                 ` Bill Findlay
2018-08-27 17:35         ` Shark8
2018-08-25 21:17       ` Luke A. Guest
2018-08-25 23:16       ` Paul Rubin
2018-08-26  8:03         ` Rene
2018-08-26 10:09         ` Simon Wright
2018-08-25 16:43 ` Jeffrey R. Carter
2018-08-25 17:38   ` patrick
2018-08-25 17:39     ` Luke A. Guest
2018-08-25 17:45       ` patrick
replies disabled

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