comp.lang.ada
 help / color / mirror / Atom feed
* How is an ADA compiler done?
@ 1996-10-26  0:00 schizophonic
  1996-10-27  0:00 ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: schizophonic @ 1996-10-26  0:00 UTC (permalink / raw)



I am following a course about languages and compilers; I would like to
have an idea about how a real-life language and compiler is done. I
will post you some questions, and I hope that someone who works in the
project of a commercial ADA compiler will answer me.

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?

Thank you!

z





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How is an ADA compiler done?
  1996-10-26  0:00 How is an ADA compiler done? schizophonic
@ 1996-10-27  0:00 ` Robert Dewar
  1996-10-29  0:00   ` schizophonic
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Dewar @ 1996-10-27  0:00 UTC (permalink / raw)



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!)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How is an ADA compiler done?
  1996-10-29  0:00   ` schizophonic
@ 1996-10-29  0:00     ` Robert Dewar
  1996-11-08  0:00       ` calling ADA from C EDSTAM Mikael
  1996-10-30  0:00     ` How is an ADA compiler done? Larry Kilgallen
  1 sibling, 1 reply; 7+ messages in thread
From: Robert Dewar @ 1996-10-29  0:00 UTC (permalink / raw)



ishizophonic asked
"Sounds strange; in my teacher's opinion, nowadays about the 50% of
commercial compilers are based on attribute grammars; in facts the
formalism was developed from the state of the art in the compiler's
algorithm (at least, the state of the art when Knuth started his
work). Is Ada (now I wrote it exactly) an exception, or is my teacher
wrong?"

Well I think you should ask your teacher to list the Fortran, COBOL and
C++ compilers that use attribute grammars :-)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How is an ADA compiler done?
  1996-10-27  0:00 ` Robert Dewar
@ 1996-10-29  0:00   ` schizophonic
  1996-10-29  0:00     ` Robert Dewar
  1996-10-30  0:00     ` How is an ADA compiler done? Larry Kilgallen
  0 siblings, 2 replies; 7+ messages in thread
From: schizophonic @ 1996-10-29  0:00 UTC (permalink / raw)



dewar@merv.cs.nyu.edu (Robert Dewar) wrote:

>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!)

Sounds strange; in my teacher's opinion, nowadays about the 50% of
commercial compilers are based on attribute grammars; in facts the
formalism was developed from the state of the art in the compiler's
algorithm (at least, the state of the art when Knuth started his
work). Is Ada (now I wrote it exactly) an exception, or is my teacher
wrong?

z





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How is an ADA compiler done?
  1996-10-29  0:00   ` schizophonic
  1996-10-29  0:00     ` Robert Dewar
@ 1996-10-30  0:00     ` Larry Kilgallen
  1 sibling, 0 replies; 7+ messages in thread
From: Larry Kilgallen @ 1996-10-30  0:00 UTC (permalink / raw)



In article <555e28$v6c@mikasa.iol.it>, schizophonic@iol.it writes:
> dewar@merv.cs.nyu.edu (Robert Dewar) wrote:
> 
>>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!)
> 
> Sounds strange; in my teacher's opinion, nowadays about the 50% of
> commercial compilers are based on attribute grammars; in facts the
> formalism was developed from the state of the art in the compiler's
> algorithm (at least, the state of the art when Knuth started his
> work). Is Ada (now I wrote it exactly) an exception, or is my teacher
> wrong?

Whether Ada is an exception by having only "one or two" compilers
developed that way depends on how lenient your teacher is with the
phrase "about 50%".  It is quite possible, however, that there are
other languages biased in the other direction, so "about 50%" may
be true across all languages.

The quality of a given compiler is not necessarily related to
whether "state of the art" techniques for arbitrary compiler
construction are utilized.  In fact, even accurate rendition of
the language is not the sole criterion for a quality compiler.
I believe it was Knuth, in fact, who developed the Web language
on the basis that _documentation_ of the implementation was one
of the most important aspects of a program.  For some situations
quality of the error messages may be most important, and I doubt
whether that goal is best served by formal approaches.

Larry Kilgallen




^ permalink raw reply	[flat|nested] 7+ messages in thread

* calling ADA from C
  1996-10-29  0:00     ` Robert Dewar
@ 1996-11-08  0:00       ` EDSTAM Mikael
  1996-11-14  0:00         ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: EDSTAM Mikael @ 1996-11-08  0:00 UTC (permalink / raw)



Is there anyone who knows how to call an ADA procedure from a C program, using gcc ?

Thanks
Mikael Edstam








^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calling ADA from C
  1996-11-08  0:00       ` calling ADA from C EDSTAM Mikael
@ 1996-11-14  0:00         ` Robert Dewar
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 1996-11-14  0:00 UTC (permalink / raw)



Mikael asks

"Is there anyone who knows how to call an ADA procedure from a C program, using g
cc ?

Thanks
Mikael Edstam"


If there is such a person, perhaps they have access to the secret document
gnatinfo.txt which has a section called

   Building a Program where the Main Program is not in Ada

:-)

To locate this secret document, check your GNAT distribution (all 
distributions of GNAT include this file).

Now of course if you are truying to execute programs of the Americal
Dental Association from C, that's harder, but I assume you mean Ada
and not ADA :-)





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-11-14  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-26  0:00 How is an ADA compiler done? schizophonic
1996-10-27  0:00 ` Robert Dewar
1996-10-29  0:00   ` schizophonic
1996-10-29  0:00     ` Robert Dewar
1996-11-08  0:00       ` calling ADA from C EDSTAM Mikael
1996-11-14  0:00         ` Robert Dewar
1996-10-30  0:00     ` How is an ADA compiler done? Larry Kilgallen

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