Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Die unsichtbaren Diener – Der Compiler und seine Artgenossen

2,338 views

Published on

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Die unsichtbaren Diener – Der Compiler und seine Artgenossen

  1. 1. Compiler Die unsichtbaren Diener – Der Compiler und seine Artgenossen Laszlo Böszörmenyi Compiler 1 / 22
  2. 2. Wozu Compiler? • Eine der ältesten und grundlegendsten Technologien • Compilertechnologie hat viele Anwendungsgebiete  Übersetzung von Programmiersprachen  Syntaxgetriebene Editoren, Kommandointerpreter  Halbformale Datenbeschreibungen (z.B. XML) • Wenn wir Compiler nicht verstehen, verstehen wir kaum, wie Programme am Rechner funktionieren  Was geschieht aufgrund folgender Programmzeilen? for (i = 0; i < 10; i++) { a[i] = a[i+1]*x.y.z; print(a[i]); } o.addSalary(float sum); if (o instance of Student) student = o else person = o;  Wie werden solche Anweisungen ausgeführt? Laszlo Böszörmenyi Compiler 2 / 22
  3. 3. Was ist ein Compiler? • Transformiert Texte einer „höheren“ formalen Sprache auf eine “niedrigere” formale Sprache Quellecode Compiler Zielcode • Der Quellcode ist üblicherweise lesbar für Menschen; der Zielcode für Maschinen  C → Intel Assembler; Pascal → Motorola Maschinencode • Ausführbarer Zielcode Input Zielcode Output Laszlo Böszörmenyi Compiler 3 / 22
  4. 4. Interpretation, Front-end, Back-end • Der Quellcode kann direkt interpretiert werden  Kommandointerpreter, Syntaxgetriebene Editoren, Scriptsprachen Quellecode Interpreter Output Input • Sprachabhängiges front-end → Zwischensprache  Z.B. Common Language Runtime (CLR in .NET) • Zielabhängiges back-end Quelle1 Front-end1 Back-end1 Ziel1 Zwischenspr. Quelle2 Front-end2 Back-end2 Ziel2 Laszlo Böszörmenyi Compiler 4 / 22
  5. 5. Interpretierte Ausführung, JIT Compilation • Der Zwischencode kann von einer virtuellen Maschine (z.B. Java VM) interpretiert werden  Z.B. Java Byte Code – JVM läuft etwa im Browser Zwischencode Input virtuelle M. Output • Zwischencode wird “just-in-time” (JIT) übersetzt  Zur Laufzeit (z.B. Java); beim Laden (z.B. im .NET) Zwischencode JIT Compiler Zielcode Output Input Laszlo Böszörmenyi Compiler 5 / 22
  6. 6. Formale Sprachen • Eine formale Sprache wird definiert durch  Ein endliches Alphabet, z.B. {0, 1} oder {a, … z, A, … Z}  Eine Grammatik als eine Menge von Regeln (Syntax) • Ein Wort (oder Satz) über das Alphabet Σ  wj = xj1 xj2 … xjm, wo Σ = {xi | 1 ≤ i ≤ n}  |wj| = m ist die Länge von wj  Σ+ : Menge der Wörter über Σ – transitive Hülle  Σ* : Σ + + {ε} – transitive und reflexive Hülle (|ε|=0)  Z.B. Σ = {0, 1}; Σ* = {ε, 0, 1, 00, 01, 11, 000, 001, …} • KEINE menschlichen Sprachen  Ziel ist Eindeutigkeit – schlecht für Humor oder Dichtung  Reife Theorie, relevant für viele Gebiete der Informatik Laszlo Böszörmenyi Compiler 6 / 22
  7. 7. Grammatiken • Grammatik G ist definiert als: G = (VN, VT, P, S)  VN: Menge der Variablen (non-terminal Symbole )  VT : Menge der Terminale (sind Teil der Sprache)  P: Menge der Produktionen (Regel der Satzbildung, der Syntax)  S: Start Symbol (S ∊ VN)  VN ∩ VT = Ø (die zwei Mengen sind disjunkt)  VN ∪ VT = V (die Vereinigung beider Mengen ist V) • P enthält Ausdrücke der folgenden Form α → β (α ∊ V+ and β ∊ V*)  Wenn α → β ∊ P und γ, δ ∊ V* : γ α δ ⇒ γ β δ : γ β δ ist eine direkte Ableitung von γ α δ Laszlo Böszörmenyi Compiler 7 / 22
  8. 8. Sprache, erzeugt durch eine Grammatik • Ableitung  Wenn α1 ⇒ α2, α2 ⇒ α3, … αn-1 ⇒ αn dann  α1 ⇒* αn d.h. αn ist eine Ableitung von α1  ⇒* ist die reflexive und transitive Hülle von ⇒  Ableitung in 0 oder mehr Schritten  ⇒n Ableitung in n Schritten • Die Sprache L, generiert durch Grammatik G ist  {w | w ∊ VT* ∧ S ⇒* w}  Die Menge aller Wörter, die aus Terminalen bestehen und aus dem Startsymbol abgeleitet werden können  Z.B.: G: VN = {S}, VT = {0, 1}, P = {S → 0S1, S → 01}  L(G) = {0n1n | n ≥ 1} Laszlo Böszörmenyi Compiler 8 / 22
  9. 9. Grammatik Typen (Noah Chomsky) • Typ-3 (regulär)  Wenn A ∊ VN, B ∊ {VN, ε}, w ∊ VT*; Form der Produktionen A → w B or A → B w (rechtslinear bzw. linkslinear) • Typ-2 (kontextfrei)  ∀ A → β ∊ P A ∊ VN (Einzelvariable) und β # ε (ε ∉ L(G))  A kann in jedem Kontext durch β ersetzt werden • Typ-1 (kontextsensitiv)  A kann nur in einem bestimmten Kontext (wie zwischen α1 und α2) durch β ersetzt werden α1A α2 → α1βα2 (α1,α2,β ∊ V*; β # ε und A ∊ VN)  ∀ α → β ∊ P gilt: |β| ≥ |α|. • Typ-0 Laszlo Böszörmenyi Compiler 9 / 22
  10. 10. Mächtigkeit der Grammatiken • Regulär ⊂ kontextfrei ⊂ kontextsensitiv ⊂ Typ-0  Typ-0 Grammatiken umfassen auch kontextsensitive Grammatiken, kontextsensitive umfassen kontextfreie und kontextfreie umfassen reguläre Grammatiken • Reguläre Grammatiken erzeugen die gleiche Klasse von Sprachen wie endliche Automaten • Kontextfreie Grammatiken erzeugen die gleiche Klasse von Sprachen wie Kellerautomaten • Zwei Grammatiken sind äquivalent, gdw. (genau dann, wenn) sie die gleiche Sprache erzeugen  G1 ≡ G2, gdw. L(G1) = L(G2) Laszlo Böszörmenyi Compiler 10 / 22
  11. 11. Regulär vs. kontextfreie Grammatiken Regulär Kontextfrei Anwendung Lexikale Analyse Syntaktische Analyse Erkannt Endliche Automaten Kellerautomaten durch (Zustände + (Zustände + Übergänge + Übergänge) Keller) Produktionen A → a | aB A→α Grenzen Z.B. Konstruktpaare Z.B. Prüfung von (was geht (Verschachtelung, Übereinstimmung von NICHT) Klammerung) Typdeklaration und (anbn [n1]) Verwendung von Typen) (anbmcndm [n1, m1]) Laszlo Böszörmenyi Compiler 11 / 22
  12. 12. Metasprachen • Definieren andere – komplexere – formale Sprachen • EBNF (Extended Backus-Naur Form)  John Backus, Peter Naur, Niklaus Wirth  Variablen: Namen für syntaktische Konstrukte  Terminale: Elemente der Sprache, zwischen “ “ A=xyz Sequenz: A besteht aus x, gefolgt durch y und z A = x1 | x2 | ... xk Alternative: A ist x1 oder x2 oder ... xk A = x [y] z Option: A ist xz oder xyz A = x {y} z Wiederholung: A ist xz oder xyz oder xy...yz A = x {y}+ z Wiederholung: y zumindest einmal (xz ist illegal) Laszlo Böszörmenyi Compiler 12 / 22
  13. 13. Syntaxdiagramme – EBNF graphisch Terminale Seq. (A = x y z) A x y z x Alternative (A = x | y | z ) A y Variablen z Wiederholung (A = x {y} z) Option (A = x [y] z) A A x z x z y y Laszlo Böszörmenyi Compiler 13 / 22
  14. 14. EBNF Beispiel • Ziffer = “0“|“1“|“2“|“3“|“4“|“5“|“6“|“7“|“8“|“9“ • Zahl = Ziffer { Ziffer } • Buchstabe = “a“ | “b“ | ... | “z“ | “A“ | “B“ | ... | “Z“ • Name = Buchstabe { Buchstabe | Ziffer } • Zahl = Ziffer | Ziffer Zahl (rekursive Definition von Zahl) Name Buchstabe • Diagramme sind leichter Ziffer zu lesen • EBNF ist sehr kompakt Buchstabe Laszlo Böszörmenyi Compiler 14 / 22
  15. 15. Grammatik Beispiel (in EBNF) 1. sentence = noun-phrase verb-phrase 2. noun-phrase = adjective noun-phrase | adjective noun 3. verb-phrase = verb adverb 4. adjective = “The” | “little” 5. noun = “boy” 6. verb = “ran” 7. adverb = “quickly” sentence noun-phrase verb-phrase noun-phrase adjective adjective noun verb adverb ? little boy ran quickly The Laszlo Böszörmenyi Compiler 15 / 22
  16. 16. Phasen der Übersetzung / Ausführung 1. Quelle-zu-Quelle Preprozessor Quellcode • Z.B. Markos, wie in C++ Preprozessor 2. Compiler erzeugt Assembly Quellcode neu Code für die Zielmaschine 3. Assembler erzeugt Compiler verschiebbaren Binärcode Ziel-Assembly 4. Linker und/oder Lader Assembler berechnen die endgültigen Adressen. Die sind entweder Verschiebbarer Code • Absolut oder Linker/Lader • Relativ zum Wert eines Registers Code in Zielsprache Laszlo Böszörmenyi Compiler 16 / 22
  17. 17. Struktur eines Compilers – Analyse 1. Lexikalische Analyse (der Scanner) wandelt den Zeichenstrom Zeichenstrom in einen Strom Scanner von Symbolen (Token) um 2. Der Parser prüft die Syntax Symbolstrom und erzeugt den Syntaxbaum Parser 3. Die semantische Analyse Symbol prüft kontextsensitive Syntaxbaum Tabelle Eigenschaften, wie Typkompatibilität Semantische Analyse 4. Symboltabelle speichert Fehler- Syntaxbaum die syntaktischen Elemente meldungen 5. Fehler können in jedem Schritt erzeugt werden Laszlo Böszörmenyi Compiler 17 / 22
  18. 18. Struktur eines Compilers – Synthese 1. Zwischencode wird Syntaxbaum erzeugt Zwischencode Generator • Fehler können auch noch hier gefunden werden Zwischencode 2. Zielunabhängige Zielunabhängiger Optimierer Optimierung 3. Zielcode wird erzeugt Zwischencode neu 4. Zielabhängige Codegenerator Optimierung Zielcode “Optimierung” nicht im Zielabhängiger Optimierer Sinn von Op. Research: Bedeutet Verbesserung Zielcode neu Laszlo Böszörmenyi Compiler 18 / 22
  19. 19. “Paradigmas” von Programmiersprachen • Prozedural (Fortran, Algol-60, C, Pascal)  Parametrisierte Prozeduren, wie P(p1, p2) und globaler Zustand  Im Mittelpunkt steht das „Verb“ (die Prozedur) • Objekt-orientiert (C++, Java, C#, Modula-3)  Objekte definieren Zustandsraum (Instanz-Variablen) und Verhalten (Methoden)  Methoden werden dynamisch (zur Laufzeit) gebunden: o.m(p1, p2) • Funktional (Lisp, ML)  Idempotente Funktionsaufrufe, ohne Seiteneffekte (im Idealfall) • Logisch (Prolog)  Deklarative Fakten und Einschränkungen definieren das Programm • Mengen basiert (SET-L, SQL) • Parallel (High-performance Fortran, Vienna Fortran) • Verteilt (Orca, Java RMI) Laszlo Böszörmenyi Compiler 19 / 22
  20. 20. Eine kleine Sprachgeschichte (1) • Fünfziger Jahre  Maschinencode, Assembly-Code  Bedarf an höheren, “abstrakten” Sprachen  Fortran (für Wissenschaft), Cobol (für Wirtschaft)  Syntax + Semantik “definiert” durch den (IBM) Compiler  1958: Übersetzter Code nur zweimal langsamer als händischer • Sechziger Jahre  Bedarf an wissenschaftlich fundierte Sprachen  Algol-60 – „the birth of computer science“ (N. Wirth)  Formale Syntax; Allgemeine Ausdrücke; Blockstruktur; Gültigkeitsbereiche; Parameterübergabe, Rekursion; Boolean  Simula-67 (O.-J. Dahl, K. Nygaard)  Erste objekt-orientierte Programmiersprache  “Wiederentdeckt” 15 Jahre später (Smalltalk-80) Laszlo Böszörmenyi Compiler 20 / 22
  21. 21. Eine kleine Sprachgeschichte (2) • Siebziger Jahre  Bedarf an sicheren (safe) Sprachen • Pascal (N. Wirth)  Strikte, statische Typprüfung + benutzerdefinierte Typen  Unterstützt „strukturierte Programmierung“ durch gründlich gewählte Anweisungen und Typkonstruktoren • C (D. Ritchie)  Entstanden als Implementierungssprache für Unix  Eine Art „höhere“ Assembly-Sprache  Ist nicht sicher (z.B. Pointers ohne Typ)  Merkwürdige Karriere: C als Implementierungssprache für große Anwendungen – eine grobe Fehlentwicklung Laszlo Böszörmenyi Compiler 21 / 22
  22. 22. Eine kleine Sprachgeschichte (3) • Achtziger Jahre - Modularität, Objekt-Orientierung  Mesa (Xerox PARC)  Interface- und Implementierungsmodule, Multi-threading  Modula-2 (N. Wirth) – wie Mesa, nur einfacher  Smalltalk-80 (A. Goldmann, Xerox PARC)  Eiffel (B. Meyer), Ada (J. Ichbiah), Modula-3 (DEC SRC)  C++ (B. Stroustrup)  Sehr mächtig, Mehrfachvererbung, nicht typsicher (C-Kompatib.) • Neunziger Jahre  Java (J. Gosling, Sun)  Typsicher (fast), Multi-threading, Garbage Collection  C# (Microsoft)  Mächtiger, effizienter und sicherer als Java – zu spät? Laszlo Böszörmenyi Compiler 22 / 22

×