Download presentation
Presentation is loading. Please wait.
1
6/27/2015G. Levine1 PROGRAMMING LANGUAGES Text: Programming Languages, Design and Implementation Pratt and Zelkowitz 4 th ed. Prentice-Hall
2
6/27/2015G. Levine2 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 levine@fdu.edu http://alpha.fdu.edu/~levine/concepts
3
6/27/2015G. Levine3 Topics of Discussion History of development of programming languages Development of specific language features Language implementation/environment Language features Programming in specific languages
4
6/27/2015G. Levine4 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
5
6/27/2015G. Levine5 History of Programming Languages 1 st generation – machine language Octal representation of op code operand (s) – memory or register cells 2 nd 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
6
6/27/2015G. Levine6 1 st and 2 nd 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
7
6/27/2015G. Levine7 Beginning of 3 rd 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
8
6/27/2015G. Levine8 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 +, /, *
9
6/27/2015G. Levine9 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
10
6/27/2015G. Levine10 Obsolete example from Fortran Do loop test at bottom at loop Do 10 I = M, 15 10 A (I) = 5 If M > 0 this still executed once. G.L. Assembler: Load I5 register1 (R1) LOOPStore 5 Array DecR1 BZR1OUT Inc LOOP JmpLOOP OUT
11
6/27/2015G. Levine11 Another obsolete example from FORTRAN Equivalence (A, B) Dimension A(100), B(100) Real A, B overlay Or Dimension A(100), B(50) Real A, Complex B alias
12
6/27/2015G. Levine12 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
13
6/27/2015G. Levine13 LISP (List Processing McCarthy 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
14
6/27/2015G. Levine14 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
15
6/27/2015G. Levine15 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 Toc50142 0108 Toc50142 0108
16
6/27/2015G. Levine16 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
17
6/27/2015G. Levine17 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
18
6/27/2015G. Levine18 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
19
6/27/2015G. Levine19 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
20
6/27/2015G. Levine20 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
21
6/27/2015G. Levine21 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.