PowerPoint Presentation by 81eN6G

VIEWS: 1 PAGES: 21

									            PROGRAMMING
            LANGUAGES
               Text: Programming Languages,
               Design and Implementation
               Pratt and Zelkowitz 4th ed.
               Prentice-Hall




9/28/2012        G. Levine                    1
            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


9/28/2012                     G. Levine                           2
            Topics of Discussion
               History of development of
                programming languages
               Development of specific language
                features
               Language
                implementation/environment
               Language features
               Programming in specific languages

9/28/2012               G. Levine               3
            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
9/28/2012                     G. Levine                     4
                   Need for synchronization
            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


9/28/2012                     G. Levine                           5
            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
9/28/2012                     G. Levine                               6
            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




9/28/2012                    G. Levine                               7
            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/28/2012                      G. Levine                                      8
            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




9/28/2012                    G. Levine                            9
            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)
                LOOP        Store        5           Array
                            Dec          R1
                            BZ           R1          OUT
                            Inc          LOOP
                            Jmp                      LOOP
                OUT

9/28/2012                    G. Levine                                10
            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

9/28/2012                      G. Levine   11
            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
9/28/2012                     G. Levine                     12
            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




9/28/2012                       G. Levine                                   13
            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




9/28/2012                          G. Levine                                                   14
            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#Toc501420108Toc50142

                0108

9/28/2012                       G. Levine                                       15
            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

9/28/2012                     G. Levine                       16
            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

9/28/2012                 G. Levine           17
            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
9/28/2012                script
                4GLs and G. Levine languages           18
            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
9/28/2012
                   Reliability Levine
                             G.                         19
            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
9/28/2012                    G. Levine                 20
            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
9/28/2012           Pascal G. Levine                         21

								
To top