CS 21: Structure of Prog. Languages - PowerPoint PPT Presentation

1 / 55
About This Presentation
Title:

CS 21: Structure of Prog. Languages

Description:

by Ole-Johan Dahl & Kristen Nygaard. for simulation purposes. descendant of ... developed at Bell Laboratories in early 1972 by Dennis Ritchie. extension of B ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 56
Provided by: jayrcfer
Category:

less

Transcript and Presenter's Notes

Title: CS 21: Structure of Prog. Languages


1
CS 21 Structure of Prog. Languages
  • Jay R.C. Fernandez, M.S.
  • Instructor

2
Evolution of the Major Programming Languages
3
PL Paradigms
  • Imperative Languages
  • Declarative Languages
  • Functional Languages
  • Object-oriented Languages
  • Event-driven Languages

4
PL Paradigms
  • Imperative Languages
  • action-oriented computation is viewed as a
    sequence of actions
  • specific order of execution of the instructions
    or statements is a must
  • a.k.a. Procedural Programming Languages
  • examples Fortran, Pascal, C

5
PL Paradigms
  • Declarative Languages
  • rule-based language
  • rules are specified in no particular order
  • the language implementation system must choose an
    execution order that produces the desired result
  • example Prolog

6
PL Paradigms
  • Functional Languages
  • functions are treated as first-class values
  • functions have the same status as other values,
    they can be part of an expression, it can be
    passed as an argument, and it can be put in a
    data structure
  • examples SML, Miranda, Haskell

7
PL Paradigms
  • Object-oriented Languages
  • has three key language features
  • Abstract Data Type
  • Inheritance
  • Polymorphism
  • examples Simula 67, C, Java

8
PL Paradigms
  • Event-driven Languages
  • program logic depends on Events
  • the user dictates the order of program execution
    not the programmer (the user drives the
    program)
  • Events mouse clicks, key press
  • examples Visual Basic, Delphi

9
Early Languages
  • Zuses PLANKALKUL (1945)
  • never implemented
  • program calculus
  • complete with advanced features in Data Structure

10
Early Languages
A 1 gt A V 4 5 S
1.n 1.n A4 1 A5
  • Plankalkuls Problem notation

11
Early Languages
  • FORTRAN (1954)
  • first compiled high-level language
  • FORmula TRANslation
  • designed for IBM 704
  • designed for scientific problems (thus, adapted a
    algebraic notation)
  • mother of high-level PLs

12
Early Languages
  • FORTRANs Contributions
  • variables assignment statements
  • concept of types
  • modularity (subprograms)
  • conditional/iterative control structures
  • formatted input/output

13
Early Languages
  • COBOL (1960)
  • COmmon Business-Oriented Language
  • not restricted by the problems of implementation
  • mandated by US Dept. of Defense

14
Early Languages
  • COBOLs Contributions
  • allowed connotative names
  • English-like syntax
  • strong data division
  • heterogeneous data structures (records)
  • manipulation of files

15
Early Languages
  • ALGOL 60
  • design a universal language
  • International Algorithmic Language
  • generalized many of Fortrans features
  • machine-independent
  • scientific problems

16
Early Languages
  • ALGOL 60s Problems
  • no input/output statements with formatting
  • sole language for publishing algorithms
  • too flexible difficult to understand
  • difficult to implement

17
Early Languages
  • ALGOL 60s Contributions
  • data types, compound statements (procedure
    calls), nested IFs (), semi-dynamic arrays
  • BNF (Backus-Naur Form) notation for describing
    the syntax of a language

18
Early Languages
  • ALGOL 60s Contributions
  • block structure (scope of variables scope of
    control statements
  • recursion the ability of a procedure to call
    itself

19
Early Languages
  • LISP (1960)
  • LISt Processing
  • Lists collections of non-contiguous memory cells
    that are chained together with pointers)
  • developed by John McCarthy at MIT
  • designed to be aIl-purpose

20
Early Languages
  • LISPs Contributions
  • non-numeric/symbolic computing
  • concept of linked list
  • concept of functions

21
Early Languages
  • APL
  • A Programming Language
  • developed by Kenneth Iverson
  • mathematical-processing
  • powerful operators
  • used non-typed arrays as primary data structure

22
Early Languages
  • BASIC (1965)
  • Beginners All-purpose Symbolic Instruction Code
  • by Thomas Kurtz / John Kemeny of Dartmouth
    College
  • very easy to learn (not science-oriented)

23
Early Languages
  • BASIC
  • small language (can be implemented on small
    computers with small memories)
  • remote terminal access time sharing
  • interactive

24
ALGOL-based Languages
  • PL/I (1965)
  • another IBM product
  • generalized programming language
  • from ALGOL 60 block structure, control
    structure, recursion
  • from FORTRAN subprograms formatted input/output

25
ALGOL-based Languages
  • PL/I
  • COBOL file manipulation record structure
  • from LISP dynamic storage allocation, linked
    structures
  • from APL array operations

26
ALGOL-based Languages
  • PL/Is Contributions
  • concurrency (multitasking)
  • exception handling (interrupt-handling)
  • pointers

27
ALGOL-based Languages
  • PL/I Sample Code
  • ADD PROCEDURE OPTIONS(MAIN)
  • GET LIST(A,B)
  • TOTAL A B
  • PUT LIST(TOTAL)
  • END ADD

28
ALGOL-based Languages
  • SIMULA 67
  • by Ole-Johan Dahl Kristen Nygaard
  • for simulation purposes
  • descendant of ALGOL 60
  • block structure control statements

29
ALGOL-based Languages
  • SIMULA 67s Contribution
  • concept of class encapsulation of data and
    procedures which can be instantiated in a number
    of objects

30
ALGOL-based Languages
  • ALGOL 68
  • general-purpose (vs. scientific orientation of
    ALGOL 60)

31
ALGOL-based Languages
  • ALGOL 68s Contributions
  • dynamic arrays
  • complexity through orthogonality vs. complexity
    through more constructs
  • user-defined data types

32
ALGOL-based Languages
  • Pascal (1969)
  • by Niklaus Wirth
  • named after Blaise Pascal
  • instructional language for teaching computer
    science

33
ALGOL-based Languages
  • Pascals Contributions
  • flexible control structure
  • user-defined data types
  • file record

34
Languages of the 70s
  • Prolog (1970)
  • PROgramming LOGic
  • Developed by Philippe Roussel of the AI Group at
    the University of Marseille
  • designed principally for artificial intelligence
    (AI) applications
  • based on the notion of defining objects and
    inferential relationships

35
Languages of the 70s
  • Prolog
  • computer programming consists of
  • declaring some facts about objects and their
    relationships
  • defining some rules about objects and their
    relationships
  • asking questions about objects and their
    relationships

36
Languages of the 70s
  • Prolog Code Example
  • girl(cindy).
  • boy(joseph).
  • likes(cindy,joseph).
  • ?- girl(cindy)
  • yes
  • ?- girl(joseph)
  • no
  • ?- likes(cindy,X)
  • Xjoseph

37
Languages of the 70s
  • C
  • developed at Bell Laboratories in early 1972 by
    Dennis Ritchie
  • extension of B
  • powerful (extensive set of operators) but at the
    expense of readability
  • language for implementing UNIX OS

38
Languages of the 70s
  • Modula 2 (1979)
  • developed by Niklaus Wirth at the Institute of
    Informatik in Zurich
  • for systems programming (independent compilation
    of procedures, asynchronous processings)

39
Languages of the 70s
  • Pascal Problems which Modula 2 addressed
  • arrays, and array parameters are fixed in size
  • no separate compilation of procedures is provided
  • type checking is always strictly enforced

40
Languages of the 70s
  • Pascal Problems which Modula 2 addressed
  • the case statement has no otherwise clause
  • the ordering among type, procedure, constant, and
    variable declarations is too strict

41
Languages of the 70s
  • Modula-2 Sample Code
  • BEGIN
  • n0 Sum0.0
  • WriteString(Enter series of numbers)
    Writeln
  • ReadReal(X) Writeln
  • While Done DO
  • nn1 SumSumX
  • ReadReal(X) Writeln
  • END

42
Languages of the 80s
  • ADA
  • most expensive and extensive language design
  • high-level language for embedded systems
  • encapsulation (data types, data objects, and
    procedures)

43
Languages of the 80s
  • ADA
  • exception handling
  • generic program units
  • concurrency
  • implementation problems (large and complex)

44
Contemporary PL
  • Visual Basic
  • evolved from B.A.S.I.C.
  • evolved as it is today in 1991 by Microsoft
    Corporation
  • currently has 6 versions
  • M.S. Windows Programming Language
  • event-driven Programming Language

45
Contemporary PL
  • Visual Basic
  • created in an Integrated Development Environment
    (I.D.E.)
  • used for Rapid Application Development (R.A.D.)

46
Contemporary PL
  • Visual Basic Sample Code
  • Private Sub compute_Click()
  • Dim sum as Integer
  • sum Val(num1.Text) Val(num2.Text)
  • result.caption The sum of num1.Text
    and _
  • num2.Text is Str(sum) .
  • End Sub

47
Contemporary PL
  • Delphi
  • drag-and-drop visual programming
  • Pascal-like syntax
  • RAD tool for Windows
  • database development tool (can access a variety
    of contemporary DBMS)

48
Contemporary PL
  • Delphi
  • Ver. 1 to 4 (Borland) Ver. 5 (Inprise)
  • Ver. 5 high productivity development solution
    for Internet and distributed computing

49
Contemporary PL
  • Delphi Sample Syntax
  • Procedure compute_Click()
  • begin
  • var sum integer
  • sum StringtoInt(num1.Text)
    StringtoInt(num2.Text)
  • result.caption The sum of num1.Text
    and _
  • num2.Text is Str(sum) .
  • end

50
Contemporary PL
  • Java
  • developed by Sun Microsystems in late 1991 but
    was introduced on 1995
  • developed by a team led by Patrick Naughton, Mike
    Sheridan, and James Gosling (The Green Project)
  • machine independent
  • designed for web programming

51
Contemporary PL
  • Java
  • both compiled and interpreted
  • vs. C/C , source is refined to native
    instructions for a particular model of processor
  • compiled to universal format (byte-code) which is
    a set of instructions for a virtual machine

52
Contemporary PL
  • Perl
  • created by Larry Wall
  • Practical Extraction and Report Language
  • interpreted language
  • excellent tool for searching and re-arranging
    large amounts of text, manipulating files, and
    managing processes
  • syntax is C/C Like

53
Contemporary PL
  • Perl Sample Code
  • !/usr/local/bin/perl
  • RequestMethod ENVREQUEST_METHOD
  • If (RequestMethod eq )
  • print Executed using command line
  • else if (RequestMethod eq GET)
  • print Content-tye text/htm\n
  • print lthtmlgtltbodygt
  • print Hello Worldltbrgt\n
  • print lt/bodygtlt/htmlgt\n

54
Contemporary PL
  • PHP
  • Hypertext Preprocessor
  • server-side, cross-platform, HTML embedded
    scripting language
  • much of its syntax is borrowed from C, Java and
    Perl
  • enables dynamically generated web pages

55
Contemporary PL
  • PHP Sample Code
  • if (addgradetrue)
  • print "ltform methodGet
    Actionresult.phpgt"
  • print "lth2gtAdd Transcript Entrylt/h2gt"
  • result pg_exec("Select stude_id from
    student")
  • rows pg_numrows(result)
  • print "lttablegtlttrgtlttdgtSubject Codelt/tdgt"
  • print "lttdgtltselect namesubj_codegt"
  • print "ltoption valueCS21gtCS 21"
  • print "ltoption valueCS93gtCS 93"
  • print "lt/selectgtlt/tdgtlt/trgt"
Write a Comment
User Comments (0)
About PowerShow.com