Programming Languages: Chapter 1
Example of Preprocessor
#include
Advantages/Disadvantages of HIS:
+ Faster than Interpretation
Advantages/Disadvantages of Interpretation:
+ No translation + Easier Implementation - Slower Execution - often requires more space
Advantages/Disadvantages of Compilation:
+ Very Fast program Execution - Slow Translation
Give examples of the lack of orthogonality in a high-level language
- A member of a structure can be any data type except void or a structure of the same type - A member of an array can be any data type except void or a function. - a+b is different than a being a pointer + b
4 Implementation Methods
- Compilation - Interpretation - Hybrid Implementation Systems - Preprocessors
4 Language Categories:
- Imperative - Functional - Logic - Programming Hybrid
What is the difference between Iteration vs Functional Programming?
- Iteration maps exactly the hardware, because the hardware requires it. - Functional uses recursion mainly without iteration
Phases of Compilation Process
- Lexical Analysis - Syntax Analysis - Semantics Analysis - Code Generation
2 Major Influences on language design
- Machine Architecture - Software development methodologies
Other Types of Evaluation Criteria
- Probability - Generality
7 Factors of Cost:
- Training Programmers - Writing Programs - Compiling Programs - Executing Programs - Development Tools - Reliability - Maintaining Programs
4 Types of Reliability:
- Type Checking - Exception Handling - Aliasing - Readability and Writability
Given an example of Data Types
- timeout = 1 is unclear - timeout = true is clear ( Using Boolean)
2 Types of Readability: Simplicity
1) Feature Multiplicity 2) Operator Overloading
Reasons for Studying Concepts of Programming Languages?
1) Increased capacity to express ideas. 2) Improved background for choosing appropriate languages. 3) Increased ability to learn new languages. 4) Better understanding of the Significance of Implementation 5) Better use of languages that are already known. 6) Overall advancement of computing
What are the 4 types of Evaluation Criteria?
1) Readability 2) Writability 3) Realibilty 4) Cost
4 Types of Readability:
1) Simplicity 2) Orthogonality 3) Data Types 4) Syntax design
2 Types of Writability:
1) Support of Abstraction 2) Expressivity
What are the benefits of understanding Implementation issues?
1) The ability to use a language more intelligently. 2) It allows us to visualize how a computer executes various language constructs.
Operator Overloading
A single operator has more than one meaning
Orthogonality
A small set of primitive constructs can be combined in a relatively small number of ways
Example of Writability vs Reliabilty
C++ pointers are powerful and very flexible but are unreliable
Examples of Imperative: Scripting Languages
C, Java, C++ etc.
Examples of Imperative: Visual Languages
Drag and Drop, Game Maker etc.
What does a lack of orthogonality lead to?
Exceptions to the rules of languages
Examples of Markup Hybird
HTML, XSLT
Feature Multiplicity
Having more than one way to accomplish a particular operation
Give an examples for Expressivity
In C, count++ is better than count = count +1
Compilation
Programs are translated into machine language
Examples of Logic
Prolog
Examples of Functional
Scheme, LISP, ML, F#
Type Checking
Testing for type errors, either by the compiler or during program execution
Exception Handeling
The ability of a program to intercept run-time errors and take corrective measures
Abstraction
The ability to define and use complex structures or operations in ways that allow details to be ignored
Probability
The ease with which programs can be moved from on implementation to another
Programming Environments
a collection of tools using in software development
Preprocessors
a program that processes a program immediately before the program is compiled
Lexical Analysis
converts characters in the source program into lexical units
Examples of Feature multiplicity:
count = count + 1 count += 1 count++ ++count
Markup Languages are not
programming languages
Th easier a program is to write,
the more likely it will be correct
Syntax analysis
transforms lexical unites into parse trees
Give an example of Abstration
use of a subprogram to implement a sort algorithm that is required several times in a program
