Steve Summit / Teil11
 
StartSeite | SteveSummit/ | Neues | TestSeite | ForumSeite | Teilnehmer | Kategorien | Index | Hilfe | Einstellungen | Ändern

Top Prev

Compiler Terminology

Compiler-Terminologie

[66] C is a compiled language. This means that the programs you write are translated, by a program called a compiler, into executable machine-language programs which you can actually run. Executable machine-language programs are self-contained and run very quickly. Since they are self-contained, you don't need copies of the source code (the original programming-language text you composed) or the compiler in order to run them; you can distribute copies of just the executable and that's all someone else needs to run it. Since they run relatively quickly, they are appropriate for programs which will be written once and run many times.
C ist eine compilierte Programmiersprache. Das heißt, die in C geschriebenen Programme werden durch einen sogenannten Compiler in die direkt ausführbaren Maschinenanweisungen übersetzt. Solche Programme benötigen keine Laufzeitumgebung und starten und arbeiten sehr schnell. Weder Programmquelle noch Compiler sind während der Programmausführung erforderlich und es genügt, die exekutierbaren Programme an die Anwender zu verteilen. Auf Grund der hohen Geschwindigkeit sind sie besonders für solche Anwendungen geeignet, bei denen Programme millionenfach unverändert über Jahre hinweg und an vielen Orten Tag für Tag eingesetzt werden.

[67] A compiler is a special kind of progam: it is a program that builds other programs. What happens is that you invoke the compiler (as a program), and it reads the programming language statements that you have written and turns them into a new, executable program. When the compiler has finished its work, you then invoke your program (the one the compiler just built) to see if it works.
Ein Compiler ist eine besondere Art Programm: Ein Programm, das andere Programme erzeugt. Der Compiler wird aufgerufen, liest die in der Programmiersprache geschriebenen Anweisungen der Programmquelle, und erzeugt daraus das ausführbare Programm. Nachdem der Compiler seine Arbeit beendet hat, kann das gerade erzeugte ausführbare Programm sofort aufgerufen und ausprobiert werden.

[68] The main alternative to a compiled computer language or program is an interpreted one, such as BASIC. An interpreted language is interpreted (by, not surprisingly, a program called an interpreter) and its actions performed immediately. If you gave a copy of an interpreted program to someone else, they would also need a copy of the interpreter to run it. No standalone executable machine-language binary program is produced.
Die Alternative zum Compiler ist der Interpreter, etwa für die Programmiersprache BASIC. Ein Interpreter führt die Befehle eines Programms unmittelbar aus (d. h. er übersetzt Befehl für Befehl in Maschinenanweisungen und führt diese dann aus), statt daraus ein ausführbares Programm zu erzeugen. Der Interpreter ist langsamer, weil er während des Programmablaufs ständig übersetzt. Wird ein Programm einer interpretierten Sprache weitergegeben, so muss auf dem Zielrechner der Interpreter verfügbar sein, um es dort auszuführen; ein einzelnes selbständig lauffähiges Programm existiert dann nicht.

[69] In other words, for each statement that you write, a compiler translates into a sequence of machine language instructions which does the same thing, while an interpreter simply does it (where "it" is whatever the statement that you wrote is supposed to do).
Zusammenfassend: Ein Compiler erzeugt für jede Programm-Anweisung eine Folge zugehöriger Maschinenanweisungen mit derselben Bedeutung, während ein Interpreter jede Programm-Anweisung unmittelbar übersetzt und ausführt.

[70] The big advantage of an interpreted language is that your program runs right away; you don't have to perform - and wait for - the separate tasks of compiling and then running your program. (Actually, on a modern computer, neither compiling nor interpreting takes much time, so some of these distinctions become less important.)
Der Vorteil eines Interpreters ist, dass der Zwischenschritt des Compilierens entfällt. (Heutzutage ist jedoch weder Compilieren noch Interpretieren besonders zeitaufwendig, so dass dieser Unterschied an Bedeutung verliert.)

[71] Actually, whether a language is compiled or interpreted is not always an inherent part of the language. There are interpreters for C,and there are compilers for BASIC. However, most languages were designed with one or the other mechanism in mind, and there are usually a few difficulties when trying to compile a language which is traditionally interpreted, or vice versa.
In Wirklichkeit ist es jedoch nicht von der Programmiersprache abhängig, ob compiliert oder interpretiert wird. So gibt es z.B. auch Compiler für BASIC und Interpreter für C. Wenn eine Sprache entworfen wird, dann hat der Sprachentwickler dabei aber normalerweise entweder einen Interpreter oder einen Compiler im Sinn, und wenn man später eine Interpreter-Sprache compilieren will oder umgekehrt, dann ist das oft mit einigen Schwierigkeiten verbunden.

[72] The distinction between compilation and interpretation, while it is very significant and can make a big difference, is not one to get worked up over. Most of the time, once you get used to the details of how you get your programs to run, you don't need to worry about the distinction too much. But it is a useful distinction to have a basic understanding of, and to keep in the back of your mind, because it will help you understand why certain aspects of computer programming (and particular languages) work the way they do.
So wichtig der Unterschied zwischen Compiler und Interpreter ist, er sollte auch nicht überbewertet werden. Während man ein Programm schreibt, gewöhnt man sich so sehr an diese Details, dass sie zur Nebensache werden. Aber es ist immerhin nützlich, die grundsätzlichen Unterschiede zu kennen, da sie uns manche Aspekte der verschiedenen Programmiersprachen besser verstehen lassen.

[73] When you're working with a compiled language, there are several mechanical details which you'll want to be aware of. You create one or more source files which are simple text files containing your program, written in whatever language you're using. You typically use a text editor to work with source files (typically you don't want to use a full-fledged text editor, since the compiler won't understand ist formatting codes). You supply each source file (you may have one, or more than one) to the compiler, which creates an object file containing machine-language instructions corresponding to your program. Your program is not ready to run yet, however: if you called any functions which you didn't write (such as the standard library functions provided as part of a programming language environment), you must arrange for them to be inserted into your program, too. The task of combining object files together, while also locating and inserting any library functions, is the job of the linker. The linker puts together the object files you give it, noticing if you call any functions which you haven't supplied and which must therefore be library functions. It then searches one or more library files (a library file is simply a collection of object files) looking for definitions of the still-unresolved functions, and pulls in any that it finds. When it's done, it either builds the final, executable file, or, if there were any errors (such as a function called but not defined anywhere) complains.
Bei der Arbeit mit einem Compiler gibt es diverse Feinheiten zu beachten. Zunächst erstellt man den Quelltext bzw. die Quelltexte in der jeweiligen Programmiersprache mit einem Text-Editor; typischerweise nicht mit einer kompletten Textverarbeitung, denn ein Compiler kann mit Formatierungen und Layout wenig anfangen. Jede dieser Quelldateien wird dann einzeln durch den Compiler übersetzt, und das Ergebnis ist jeweils eine sogenannte Objekt-Datei mit den Maschinenanweisungen. Die Objekt-Dateien sind jedoch in der Form noch nicht direkt ausführbar, denn im Allgemeinen enthalten sie Aufrufe von Funktionen, die in ihnen nicht enthalten sind, insbesondere Aufrufe von Funktionen aus der Standardbibliothek des Compilers. Die Objekt-Dateien müssen folglich mit diesen Funktionen zusammengefasst werden, was die Aufgabe des Linkers ist. Der Linker kombiniert alle Objekt-Dateien und die erforderlichen Bibliotheksfunktionen in eine ausführbaren Programmdatei. Sollte das dem Linker nicht möglich sein - etwa weil er eine aufgerufene Funktion nicht findet - dann endet das mit einer Fehlermeldung.

[74] If you're using some kind of an integrated programming environment, many of these steps may be taken care of for you so automatically and seamlessly that you're hardly aware of them.
Verwendet man andererseits eine sogenannte integrierte Programmierumgebung, so finden die Aufrufe von Compiler und Linker meistens automatisch und reibungslos im Hintergrund statt, so dass wir davon kaum etwas wahrnehmen.


Anmerkungen, Korekturen, Diskussion

Der Text von Steve Summit zeigt an manchen Stellen schon ein bisschen, der er schon etliche Jahre am Buckel hat. Deswegen auch einige Freizügigkeiten in der Übersetzungen.


Top Prev
StartSeite | SteveSummit/ | Neues | TestSeite | ForumSeite | Teilnehmer | Kategorien | Index | Hilfe | Einstellungen | Ändern
Text dieser Seite ändern (zuletzt geändert: 14. Mai 2002 10:41 (diff))
Suchbegriff: gesucht wird
im Titel
im Text