Your SlideShare is downloading. ×
0
Compilation From code to executable By David Halliday
Stages from Source to Executable <ul><li>Compilation:  </li></ul><ul><ul><li>source code ==> relocatable object code (bina...
Phases of the Compilation Process 1 <ul><li>Lexical analysis (scanning):  </li></ul><ul><ul><li>the source text is broken ...
Phases of the Compilation Process 2 <ul><li>Machine-independent optimization: </li></ul><ul><ul><li>intermediate code is o...
Upcoming SlideShare
Loading in...5
×

Compilation

514

Published on

This covers details of the processes of compilation. A lot of extra teaching support is required with these.
Originally written for AQA A level Computing (UK exam).

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
514
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Compilation"

  1. 1. Compilation From code to executable By David Halliday
  2. 2. Stages from Source to Executable <ul><li>Compilation: </li></ul><ul><ul><li>source code ==> relocatable object code (binaries) </li></ul></ul><ul><li>Linking: </li></ul><ul><ul><li>many relocatable binaries (modules plus libraries) ==> one relocatable binary (with all external references satisfied) </li></ul></ul><ul><li>Loading: </li></ul><ul><ul><li>relocatable ==> absolute binary (with all code and data references bound to the addresses occupied in memory) </li></ul></ul><ul><li>Execution: </li></ul><ul><ul><li>control is transferred to the first instruction of the program </li></ul></ul>
  3. 3. Phases of the Compilation Process 1 <ul><li>Lexical analysis (scanning): </li></ul><ul><ul><li>the source text is broken into tokens. </li></ul></ul><ul><li>Syntactic analysis (parsing): </li></ul><ul><ul><li>tokens are combined to form syntactic structures, typically represented by a parse tree. </li></ul></ul><ul><ul><li>The parser may be replaced by a syntax-directed editor, which directly generates a parse tree as a product of editing. </li></ul></ul><ul><li>Semantic analysis: </li></ul><ul><ul><li>intermediate code is generated for each syntactic structure. </li></ul></ul><ul><ul><li>Type checking is performed in this phase. </li></ul></ul>
  4. 4. Phases of the Compilation Process 2 <ul><li>Machine-independent optimization: </li></ul><ul><ul><li>intermediate code is optimized to improve efficiency. </li></ul></ul><ul><li>Code generation: </li></ul><ul><ul><li>intermediate code is translated to relocatable object code for the target machine. </li></ul></ul><ul><li>Machine-dependent optimization: </li></ul><ul><ul><li>the machine code is optimized. </li></ul></ul><ul><ul><li>On some systems (e.g., C under Unix), the compiler produces assembly code, which is then translated by an assembler. </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×