Beruflich Dokumente
Kultur Dokumente
Module 1
Concepts of Programming Languages
Robert W Sebesta
Programming Language
Notational system for describing computation
in machine readable and human readable
form.
3
High Level
Readable familiar notations
machine independence
availability of program libraries
consistency check (check data types)
Types of Programming Languages
First Generation Languages
Machine
0000 0001 0110 1110
0100 0000 0001 0010
6
1.1: 6 Reasons for Studying Concepts
of Programming Languages
Nail fixhammer
Screwscrewdriver
- Deals with implmn issues that affects those concepts.
- Leads to understanding of y lngs are designed in the way they are.
- Leads to ability to use a lng more intelligently.-> can b better pgmrs.
- Certain pgm bugs can be found and fixed.
- Can visualize how computer execute various lng constructs.
- Hints abt the relative efficiency of alternative constructs. Large caln ->fortran
Buisness
reportscobol,
- E.g; frequently called subpgm is inefficient design choice. seqel.
6 Reasons for Studying Concepts of
Programming Languages
2. Business applications
Produce reports, use decimal numbers and characters.
COBOL (Common Business Oriented Language) in 1950s.
5 Programming Domains
3. Artificial intelligence:
- Jobs that computers cant do are done.
(Symbol Manipulation, Playing Games, Planning a route based on map,
understanding speech)
Symbols rather than numbers manipulated; use of linked lists
LISP (List Processing)
Char(len=30):: name(100)
Integer::age(100),employeeno(100)
Real::salary(100)
readable and reliable. Here it uses 4 diff arrays instead of structure of arrays.
5) Syntax considerations
mea
2 Evaluation Criteria: Writability(3)
Simplicity and orthogonality Cobol and Sequel->
Few constructs, a small number of primitives, a
report generation.
small set of rules for combining them But not good for
matrix multiplication.
Support for abstraction
APL/ FORTRAN is in
The ability to define and use complicated reverse.
structures or operations in ways that allow
details to be ignored Data Abstrn is the
e.g., a subprogram to implement a sort program. concept that is used
Without abstraction, the sort code have to be in Binarytrees. But
replicated in all places where it was needed. using Fortran it is
Expressivity
difficult to
implement, since
A language has relatively convenient ways of Fortran does not
specifying computations, e.g., a++ is more know the use with
convenient that a=a+1 in C. pointers and
structures.
3 Evaluation Criteria: Reliability(4)-
Assurance that there wont be any unexpected or unwanted behavior on pgm
2. Programming Methodologies
Structured Programming and Data Abstraction simplify many tasks in s/w development
Computer Architecture Influence
Since 1940s Well-known computer architecture:
Von Neumann
Imperative languages, In von Neumann computer,
Data and programs stored in memory
Memory is separate from CPU
Instructions and data are piped from memory to CPU
Results moved back to memory
Basis for imperative languages
Central features, Variables model memory cells
Assignment statements model piping, repetition.
Iteration is fast and efficient
Instructions are store in adjacent cells of memory
Repeating the code requires only a simple branch instruction
Discourages the use of recursion.
The von Neumann Architecture
Single m/y
Programs
Variables
A=b+c
A=
Execute
The execution of von Neumann
Architecture
Fetch-execute-cycle (on a von Neumann
architecture computer)
1950s and early 1960s: Simple applications; worry about machine efficiency
Late 1960s: People efficiency became important; readability, better control
structures- shift in cost of computing h/w and s/w.
(petroleum refining, airline reservation systems)
structured programming
top-down design and step-wise refinement.
Incomplete type checking, inadequacy of control stmts, heavy use of gotos
Late 1970s: Shift from Procedure-oriented to data-oriented
(abstraction is the process by which data and programs are defined with a
representation similar to its meaning (semantics), while hiding away the
implementation details)- SIMULA 67
Middle 1980s: Object-oriented programming
Data abstraction + inheritance + polymorphism+ dynamic(run time)
method binding.
(inheritance suggests an object is able to inherit characteristics from another object)
(Polymorphism is the capability of an action or method to do different things based on the
object that it is acting upon)
Language Categories: 4 Bins/
Paradigms
1. Imperative: how to perform tasks.
2. Functional: algm as fn defn.
3. Declarative: specifies fn decln.
4. Object Oriented: create classes and objs.
Implementation Methods
2 ways to translate a pgm
Primary components of a computer
Internal Memory -Compilation
Stores data and programs
Processor
-Pure Interpretation
Primitive operations/ machine -Hybrid implementation.
instructions
Arithmetic and logic operations 1) Bit translation
Macro Instructions
Set of micro instructions
2) Hybrid translation-
Machine Language preliminary processing
Set of instructions and then translate
Cant be seen by software
what u need, when u
Only understood by hardware
Requires system software to create
need.
an interface between the programs in
high level language and machine language
Virtual Computers
Pure Interpretation
Programs are interpreted by another program known as an interpreter
1-48
Just-in-Time Implementation Systems
i/p
Some of the bindings and their binding times for the parts of this
assignment statement are as follows:
3) Pgm is translated.