Imperative programming
School of Technology and Management
Introduction
[email protected]
ESTiG
[email protected] (ESTiG) Imperative programming 1/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Language is of paramount importance for sentient species
Correct use of language correct interpretation
Instructions outline the path to achieve a certain goal/task
A set of words is used for actions (functions)
ex. : buy fruit
Additional information may be provided for the requested action
(variables/parameters):
ex. : buy 2kg of apple fruit
A sequence of actions and information can be viewed as the
execution that leads to a goal
[email protected] (ESTiG) Imperative programming 2/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Computer
An electronic device for storing and processing data, typically in binary
form, according to instructions given to it in a variable program.
instructions given to it sounds familiar?
Computer language is coded in binary:
'A' → 0100 0001
'B' → 0100 0010
...
Binary is hard for humans (. . . most of them)
An intermediate language, using a human vocabulary would be more
appropriate
Thus the reason for the existence of Programming Languages
[email protected] (ESTiG) Imperative programming 3/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming language vocabulary of pre-determined
instructions
Instructions written according to a set of rules
Rules are specic to each language
Normally well-documented in the so called language reference
Example - https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.htmlC
language reference
The languages reference enumerates all the instructions available to
the programmer
The language's instructions allow you to (among others. . . ):
Use a limited vocabulary/grammar to describe a program
Access the computer's main resources (storage, memory, input/output)
Extend the base instructions to implement new functionality
Reuse similar blocks of code in multiple programs
[email protected] (ESTiG) Imperative programming 4/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
pi = 3.14
radius = 2
area = pi * radius * radius
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
pi = 3.14 intaddr equ 1 ch *4
radius = 2 segaddr equ 62 h *4
area = pi * radius * radius mfactor equ 17478
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
pi = 3.14 intaddr equ 1 ch *4
radius = 2 segaddr equ 62 h *4
area = pi * radius * radius mfactor equ 17478
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
pi = 3.14 intaddr equ 1 ch *4
radius = 2 segaddr equ 62 h *4
area = pi * radius * radius mfactor equ 17478
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
Programming languages range from high level to low level
High level languages closer to the human language
Low level languages closer to machine language
Each language excels depending on the application type
There is truly no best language
There is only the most productive language for each set of needs
pi = 3.14 intaddr equ 1 ch *4
radius = 2 segaddr equ 62 h *4
area = pi * radius * radius mfactor equ 17478
[email protected] (ESTiG) Imperative programming 5/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ;
driveTo ( " market place " );
buyFruit (" apples " , 2 , " KG ") ;
pay (2.6 , " EUR " );
driveTo ( " home ") ;
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ;
driveTo ( " market place " );
buyFruit (" apples " , 2 , " KG ") ;
pay (2.6 , " EUR " );
driveTo ( " home ") ;
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ;
driveTo ( " market place " );
buyFruit (" apples " , 2 , " KG ") ;
pay (2.6 , " EUR " );
driveTo ( " home ") ;
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ;
driveTo ( " market place " );
buyFruit (" apples " , 2 , " KG ") ;
pay (2.6 , " EUR " );
driveTo ( " home ") ;
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ;
driveTo ( " market place " );
buyFruit (" apples " , 2 , " KG ") ;
pay (2.6 , " EUR " );
driveTo ( " home ") ;
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
A set of instructions compose the program's source-code
This source-code is not yet ready to be executed by the computer!
Every language provides a special translator
This translator is responsible for:
Translating the language's instructions in the program's source-code
Providing feedback to the programmer about any syntax errors
Converting/delivering the textual instructions in computer readable
content
startCar () ; 0000000 cf fa ed fe 07 00 00 01 ...
driveTo ( " market place " ); 0000010 0f 00 00 00 b0 04 00 00 ...
buyFruit (" apples " , 2 , " KG ") ; 0000020 19 00 00 00 48 00 00 00 ...
pay (2.6 , " EUR " ); 0000030 52 4f 00 00 00 00 00 00 ...
driveTo ( " home ") ; ...
[email protected] (ESTiG) Imperative programming 6/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
There are 3 types of translators:
assembler used in low-level languages
Translates
https://en.wikipedia.org/wiki/Assembly_languageassembly
code into object-code
Because the code is low-level, translation is mechanical
compiler normally used in high-level languages
Translates the whole code into object-code
Identies code patterns and introduces optimizations
Optimizations have a positive impact program's performance
Examples: C, C++, Pascal, Cobol, . . .
interpreter interpreted programming languages
No object-code is produced
On some cases, code is translated in a per-statement basis
Overall program execution is slower (it's debatable)
Examples: PHP, Java, Python, C#, .. .
[email protected] (ESTiG) Imperative programming 7/1
Programming Languages
Programming Languages
Natural Language
[email protected] (ESTiG) Imperative programming 8/1
Programming Languages
Programming Languages
Natural Language
High-level Language Low-level Language
[email protected] (ESTiG) Imperative programming 8/1
Programming Languages
Programming Languages
Natural Language
High-level Language Low-level Language
Source-code
int main () { /* */ }
[email protected] (ESTiG) Imperative programming 8/1
Programming Languages
Programming Languages
Natural Language
High-level Language Low-level Language
Source-code
int main () { /* */ }
Assembler Compiler Interpreter
[email protected] (ESTiG) Imperative programming 8/1
Programming Languages
Programming Languages
Natural Language
High-level Language Low-level Language
Source-code
int main () { /* */ }
Assembler Compiler Interpreter
Machine Object-code
Language
0000000 cf fa ed fe ...
[email protected] (ESTiG) Imperative programming 8/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Qualities of a good Programming Language
Writability → ability to express a program clearly, correctly, concisely
and quickly
Readability → the nature and functionality of a program is easy to
comprehend
Reliability → the outcome is predictable, without unexpected results
Maintainability → easy to maintain, review and update
Generality → ability to replace similar tasks with reusable blocks of
code
Extensibility→ provides a general mechanism for the programmer to
add new constructs
Standard → moving the code to another device results in a similar
outcome (cross-platform)
[email protected] (ESTiG) Imperative programming 9/1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1
Programming Languages
Development Tools
Programming Languages dened by standards (ANSI, ISO, IEEE,
...)
Well-dened language standards wider range of development tools
Writing program source-code IDE (Integrated Development
Environment)
Why? Auto-completion, debugging, inline documentation,
syntax-highlighting, . . .
https://www.visualstudio.com/Microsoft Visual Studio
https://www.jetbrains.com/clion/Jetbrains CLion (commercial
→ educational license available)
...
Microsoft Visual Studio - recommended for all students (using
Windows)
Jetbrains CLion - alternative for other platforms (Linux, Mac, . . . )
[email protected] (ESTiG) Imperative programming 10 / 1