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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,34c128c452eed637 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: How is an ADA compiler done? Date: 1996/10/27 Message-ID: #1/1 X-Deja-AN: 192495369 references: <54u38v$g9o@mikasa.iol.it> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-27T00:00:00+00:00 List-Id: ischizophonic asks "1- is ADA an LR(1), an LALR(1) language, or neither? 2- how is a commercial ADA compiler structured? 3- what kind of tools are used to support the developing of the compiler? 4- are there some features in the language that deserve particular attention, or create particular trouble? 5- are attribute grammars the formalism used for the semantical analisis? if not, what kind of formalism is used, and why?" To ask if Ada (please spell it right, you have been arond here long enough not to make this mistake :-) is LR(1) or LALR(1) is very confused. Of course it is possible to parse Ada using an LR(1) or LALR(1) parser, and some Ada compilers use such parsers, some do not. Parsers almost never recognize exactly the same language that is defined in the RM anyway (it is virtually impossible to do so, for some very subtle reasons), but that is not a problem, since there is no such requirement in a compiler. TO see how one commercial Ada compiler is structured, have a look at the sources of GNAT. They are certainly not typical in the following respects. The parser is built by hand, and is not table driven. A very deliberate choice which allows us to do a better job on error messages. The backend IS table driven, which is not so common in other compilers. To write a new code generator, we don't write any code, just a description of the target machine. As to special features, there is a huge literature on this subject, I suggest looking through proceedings of past Ada conferences. Are atrtibute grammars used? Yes by one or two compilers, No by most. I don't think it is a particularly helpful formalism. At least one commercial compiler, the DDCI compiler does, as far as I know use this approach, but on the other hand, it is much later than expected, so it is certainly not a demonstration that this technique is specially effective (it is also not a demonstraion to the contrary either, there are MANY things that can make compilers later than hoped, as all of us in the business know well!)