+ All Categories
Home > Documents > 6/27/2015G. Levine1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation...

6/27/2015G. Levine1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation...

Date post: 21-Dec-2015
Category:
View: 219 times
Download: 0 times
Share this document with a friend
21
03/25/22 G. Levine 1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation Pratt and Zelkowitz 4 th ed. Prentice-Hall
Transcript

04/18/23 G. Levine 1

PROGRAMMING LANGUAGES

Text: Programming Languages, Design and Implementation

Pratt and Zelkowitz 4th ed.

Prentice-Hall

04/18/23 G. Levine 2

Introduction

Concepts underlying all computer programming Assist in learning new languages Assist in understanding current

languages Efficiency, reliability considerations Design and reuse considerations Implementation details

G. Levine 692-2498 [email protected] http://alpha.fdu.edu/~levine/concepts

04/18/23 G. Levine 3

Topics of Discussion

History of development of programming languages

Development of specific language features

Language implementation/environment

Language features Programming in specific languages

04/18/23 G. Levine 4

Language Paradigms Imperative/ procedural languages

Assignment statement is chief characteristic – places value in CELL

consider x = x *x + 1 Functional/ applicative languages

(sum (times (x x) 1)) not placed in x Rule-based / logic programming Object-oriented programming

Imperative style in the small Module communication similar to applicative

languages Concurrent programming

Need for synchronization

04/18/23 G. Levine 5

History of Programming Languages 1st generation – machine language

Octal representation of op code operand (s) – memory or register cells

2nd generation- assembly language Symbolic op codes, operands

Translated by assembler to machine language

Delay in binding from writing to translating time of symbolic name to machine address

04/18/23 G. Levine 6

1st and 2nd generation languages continued Problems

Not portable- specific to hardware Difficult to read, i.e., maintain

Consider 011111010011 as an instruction Difficult to write (see above) Lack of structures in machine language

Data- support for arrays (block memory)• Array looping with self modifying code

Control - conditional and jump (goto) Some reuse already existed –

Programmers shared debugged i/o and mathematical routines

04/18/23 G. Levine 7

Beginning of 3rd generation languages Grace Hopper- early 1950s A-O,

B-O use of subroutines scientific (military uses)

http://www.cs.yale.edu/homes/tap/hopper-story.html Lack of hardware support

04/18/23 G. Levine 8

FORTRAN I(Backus & team) 1954-7 History – see

http://www.ibiblio.org/pub/languages/fortran/ch1-1.html

Goals Efficiency (still valid) Formula translation – scientific

applications Research Contributions

Expressions (precendence rules, .GT., etc.)

Multidimensional array manipulation Do loops

IBM704- index registers, keyboard included +, /, *

04/18/23 G. Levine 9

Early FORTRAN – disadvantages Concern for storage – use of equivalence, etc. Fixed format; no reserved words; blanks ignored Implicit typing Spaghetti code Loop and conditional hard to distinguish No record type

04/18/23 G. Levine 10

Obsolete example from Fortran Do loop test at bottom at loop

Do 10 I = M, 15

10 A (I) = 5If M > 0 this still executed once.

G.L. Assembler:Load I5 register1 (R1)

LOOP Store 5 ArrayDec R1BZ R1 OUTInc LOOP Jmp LOOP

OUT

04/18/23 G. Levine 11

Another obsolete example from FORTRANEquivalence (A, B)

Dimension A(100), B(100)

Real A, B overlay

Or

Dimension A(100), B(50)

Real A, Complex B alias

04/18/23 G. Levine 12

Why FORTRAN was successful? Evolved: Fortran II, IV, 77, 90

Upward compatibility Portability

Compiled languages can be machine independent – role of standardization

Efficiency Array manipulation Static storage allocation

Support for numeric applications Complex numbers as primitive data type

Strong support from IBM

04/18/23 G. Levine 13

LISP (List ProcessingMcCarthy 1958-1960) Functional language Symbolic applications (A.I.) Recursion and conditional as

control structures List as primitive data structure Garbage collection http://www-formal.stanford.edu/jmc/history/lisp/lisp.html

04/18/23 G. Levine 14

ALGOL (Backus + team) 1958-1960) Algorithmic language

Free format Structured control

Sequence, conditional, loop Blocks (scope rules) stack storage allocation (recursion)

Own (static) variables BNF – meta language to precisely define

a language I/O not defined – NOT PORTABLE http://www.cs.iastate.edu/~leavens/ComS541Fall97/hw-pages/history/algol.html

04/18/23 G. Levine 15

COBOL –1960s

Business Applications Fixed Format Stress on data structures

Data division Record type Fixed point type

“circles” of compilers for advanced business capabilities

http://students.albion.edu/JMcatee/expert.htm#Toc501420108

Toc501420108

04/18/23 G. Levine 16

Example from COBOL

Data defined by bytes Great for portability

(note that C’s int type may be implemented by 16 or 32 bits)

Need to save storage.01 Date.

05 Month pic 99.

05 Date pic 99.

05 Year pic 99.

– y2K This feature was an option in PL/1

04/18/23 G. Levine 17

Why COBOL was (is) successful? DoD Support Easy to read

Self documenting Fairly easy to write

English type statements (perform 5 times)

Great data support Interface to databases

04/18/23 G. Levine 18

Other languages

PL/1- late 60s – all purpose language – pointers, exception handling

Simula67- simulation language- classes and coroutines

Smalltalk –late 1970s- object oriented; entire programming environment

C - 1970s – system programming (UNIX) Small, efficient, Bell Labs support

Ada83 – software engineering principles C++ 1980s object oriented C Java – 1990s – for the Internet 4GLs and script languages

04/18/23 G. Levine 19

Environments

Early batch systems Efficiency of time and space

Time-sharing systems User Friendliness Interactive I/O

PC and the Internet Graphical features

Embedded systems Time constraints (hard real time) Parallel activities Error control Reliability

04/18/23 G. Levine 20

What should we look for in a language? Research contributions Strengths, weaknesses

Specific or general applications Support of Control abstraction Support of Data abstraction Support of Reuse

Modification/ maintainability Portability Generality

Efficiency Compiled or interpreted

04/18/23 G. Levine 21

Syntax and Semantics

Syntax – rules of the language first compiler phase is parsing, which

determines whether module is a valid string of the language

Semantics- what goes into the cells and when

We’ll see many examples of different ways that syntax can be interpreted Ex: parameter passing

Orthogonality – whether valid syntactic elements can be combined Ex: a file cannot be a value parameter in

Pascal


Recommended