Documente Academic
Documente Profesional
Documente Cultură
FUNDAMENTALS
Dr. Sheikh Faisal Rashid
shfaisal@gmail.com,uet.edu.pk
Department of Computer Science and
Engineering UET Lahore
INTRODUCTION
Machine language
Programming Languages
Our First Program
MACHINE INSTRUCTION
What’s a program
What Do Instructions Look Like
Machine Instruction
Parts of a Machine Instruction
Instruction Lengths
Machine Instruction Types
Example: An Instruction
Example: Program in Machine Codes
PROGRAMING
LANGUAGES
Programming Language
Design Considerations
Assembly Language
Assembly Language Characteristics
Assembly Language Example
Third Generation Languages
Language Translators
Formal Languages
Timeline of Programming Languages
Programming Paradigms (1/2)
Programming Paradigms (2/2)
Imperative Programming Language
Example of Data Declaration
Elements of an Imperative PL
Translating a Program
Syntax Diagram
Algebraic Expression Syntax
Example of Parsing An Expression
Code Generation and Optimization
Expressions Representation
• All of programming falls under the domain of mathematics
• We cannot use mathematical notation in programming
languages, and thus we must use other means of
describing our intentions
Expression Representation in C++
2(x +3 y) 2*(x + y)
n
3 (n*n*n)/3
1
9.8s 2 v0 s
2
0.5*9.8*s*s + v0*s
sin(x) sin(x)
|x| abs(x)
x
sqrt(x)
HELLO WORLD!
Our first program
#include <iostream>
int main();
int main() {
std::cout << "Hello world!";
std::cout << std::endl;
return 0;
}
Our first program
• There are two approaches we can take to compiling and
executing this code:
• Using an Integrated Development Environment (IDE)
• We will use Eclipse in the laboratories
• Using an on-line compiler such as http://cpp.sh/