






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to compilers and the compilation process. It explains what compilers are, their role in translating high-level source code into low-level machine code, and the differences between human-readable source code and machine code. It also covers the challenges of ensuring correct translation and the complexity of the compilation process.
Typology: Slides
1 / 12
This page cannot be seen from the preview
Don't miss anything!







10
What are Compilers
Translate information from one representation to another
Usually information = program
12
In This Course
We will study typical compilation:
from programs written in high- level languages to low-level object code and machine code
13
Typical Compilation
High-level source code
Compiler
Low-level machine code
15
Source Code
Optimized for human readability
Matches human notions of grammar
Uses named constructs such as variables and procedures
16
Assembly Code
. globl _expr _expr: pushl %ebp movl %esp,%ebp subl $24,%esp movl 8(%ebp),%eax movl %eax,%edx leal0(,%edx,4),%eax movl %eax,%edx imull 8(%ebp),%edx movl 8(%ebp),%eax incl %eax
imull %eax,%edx movl 8(%ebp),%eax incl %eax imull %eax,%edx movl %edx,-4(%ebp) movl -4(%ebp),%edx movl %edx,%eax jmp L .align 4 L2: leave ret
18
How to Translate
Correctness: the generated machine code must execute precisely the same computation as the source code
19
How to Translate
Is there a unique translation? No!
Is there an algorithm for an “ideal translation”? No!