Download - Programming Language Concepts (CIS 635)
![Page 1: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/1.jpg)
Programming Language Concepts (CIS 635)
Elsa L Gunter
4303 GITC
NJIT, www.cs.njit.edu/~elsa/635
![Page 2: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/2.jpg)
Copyright 2002 Elsa L. Gunter
Contact Information
• Office: 4303 GITC
• Office hours:– Mondays 10:45 – 11:25, 2:30 – 3:10– Wednesdays 10:45 – 12:10– Tuesdays and Thursdays by appointment
• Email: [email protected]
![Page 3: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/3.jpg)
Copyright 2002 Elsa L. Gunter
Course Structure
• Text: Concepts of Programming Languages, by Robert W. Sebesta (5th edition)
• Credit:– Homework 35% (submitted in class)
• Includes programming– Midterm 25%– Final 40%
![Page 4: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/4.jpg)
Copyright 2002 Elsa L. Gunter
Course Dates
• Homework due each Monday at the beginning of class. No email homework.
• March 11: In class midterm
• DO NOT MISS EXAM DATE!
![Page 5: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/5.jpg)
Programming Language Concepts (CIS 635)
Elsa L Gunter
4303 GITC
NJIT, www.cs.njit.edu/~elsa/635
![Page 6: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/6.jpg)
Copyright 2002 Elsa L. Gunter
Personal History
• First began programming almost 30 years ago
• First languages: basic, DG nova assembler
• Since have programmed in at least 10 different languages– Not including AWK, sed, shell scripts,
latex, HTML, etc
![Page 7: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/7.jpg)
Copyright 2002 Elsa L. Gunter
Personal History
One language may not last you all day, let alone your whole programming life
![Page 8: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/8.jpg)
Copyright 2002 Elsa L. Gunter
Programming Language Goals
• Original Model:– Computer expensive, people cheap;
hand code to keep computer busy
• Today:– People expensive, computers cheap;
write programs efficiently and correctly
![Page 9: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/9.jpg)
Copyright 2002 Elsa L. Gunter
Programming Language Goals
• Mythical Man-Month Author Fred Brookes“The most important two tools for
system programming … are (1) high-level programming languages and (2) interactive languages”
![Page 10: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/10.jpg)
Copyright 2002 Elsa L. Gunter
Why Study Programming Languages?
Helps you to:– understand efficiency costs of given
constructs
– think about programming in new ways
– choose best language for task
– design better program interfaces
– learn new languages
![Page 11: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/11.jpg)
Copyright 2002 Elsa L. Gunter
How to Study Programming Languages
• Many features for one language at a time or many languages for one feature at a time– We will mainly choose the second method
in this course
• Design and Organization– Syntax: How a program is written– Semantics: What a program means– Implementation: How a program runs
![Page 12: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/12.jpg)
Copyright 2002 Elsa L. Gunter
How to Study Programming Languages
• Major Language Features– Imperative / Applicative / Rule-based
– Sequential / Concurrent
![Page 13: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/13.jpg)
Copyright 2002 Elsa L. Gunter
Course Outline – First Half
• History and Overview
• Introduction to SML
• Language Analysis and Translation
• Program Semantics
• Elementary Types
![Page 14: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/14.jpg)
Copyright 2002 Elsa L. Gunter
Course Outline – Second Half
• Abstraction and Encapsulation– Structured Types– Abstract datatypes
• Introduction to Java• Abstraction and Encapsulation
– Inheritance– Subprograms– Modules
• Control of Execution
![Page 15: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/15.jpg)
Copyright 2002 Elsa L. Gunter
Course Outline - Time allowing,
• Runtime Storage Management
• Distributed Computing
![Page 16: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/16.jpg)
Copyright 2002 Elsa L. Gunter
Historical Environment
• Mainframe Era–Batch environments (through
early 60’s and 70’s)• Programs submitted to operator as
a pile of punch cards; programs were typically run over night and output put in programmers bin
![Page 17: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/17.jpg)
Copyright 2002 Elsa L. Gunter
Historical Environment
• Mainframe Era–Interactive environments
• Multiple teletypes and CRT’s hooked up to single mainframe
• Time-sharing OS (Multics) gave users time slices
• Lead to compilers with read-eval-print loops
![Page 18: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/18.jpg)
Copyright 2002 Elsa L. Gunter
Historical Environment
• Personal Computing Era– Small, cheap, powerful– Single user, single-threaded OS (at
first any way)– Windows interfaces replaces line
input– Wide availability lead to inter-
computer communications and distributed systems
![Page 19: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/19.jpg)
Copyright 2002 Elsa L. Gunter
Historical Environment
• Networking Era– Local area networks for printing, file
sharing, application sharing
– Global network • First called ARPANET, now called
Internet• Composed of a collection of protocols:
FTP, Email (SMTP), HTTP (HMTL), URL
![Page 20: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/20.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Simplicity – few clear constructs, each with unique meaning
• Orthogonality - every combination of features is meaningful
• Flexible control constructs
![Page 21: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/21.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Rich data structures – allows programmer to naturally model problem
• Clear syntax design – constructs should suggest functionality
• Support for abstraction - program data reflects problem being solved; allows programmers to safely work locally
![Page 22: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/22.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Expressiveness – concise programs
• Good programming environment
• Architecture independence and portability
![Page 23: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/23.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Readability–Simplicity
–Orthogonality
–Flexible control constructs
–Rich data structures
–Clear syntax design
![Page 24: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/24.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Writability–Simplicity–Orthogonality–Support for abstraction–Expressivity–Programming environment–Portability
![Page 25: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/25.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Usually readability and writability call for the same language characteristics
• Sometimes they conflict:– Comments: Nested comments (e.g
/*… /* … */ … */ ) enhance writability, but decrease readability
![Page 26: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/26.jpg)
Copyright 2002 Elsa L. Gunter
Features of a Good Language
• Reliability–Readability
–Writability
–Type Checking
–Exception Handling
–Restricted aliasing
![Page 27: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/27.jpg)
Copyright 2002 Elsa L. Gunter
Language Paradigms – Imperative Languages
• Main focus: machine state – the set of values stored in memory locations
• Command-driven: Each statement uses current state to compute a new state
• Syntax: S1; S2; S3; ...• Example languages: C, Pascal,
FORTRAN, COBOL
![Page 28: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/28.jpg)
Copyright 2002 Elsa L. Gunter
Language Paradigms – Object-oriented Languages
• Classes are complex data types grouped with operations (methods) for creating, examining, and modifying elements (objects); subclasses include (inherit) the objects and methods from superclasses
![Page 29: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/29.jpg)
Copyright 2002 Elsa L. Gunter
Language Paradigms – Object-oriented Languages
• Computation is based on objects sending messages (methods applied to arguments) to other objects
• Syntax: Varies, object <- method(args)
• Example languages: Java, C++, Smalltalk
![Page 30: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/30.jpg)
Copyright 2002 Elsa L. Gunter
Language Paradigms – Applicative Languages
• Applicative (functional) languages– Programs as functions that take arguments
and return values; arguments and returned values may be functions
– Programming consists of building the function that computes the answer; function application and composition main method of computation
– Syntax: P1(P2(P3 X))– Example languages: ML, LISP, Scheme
![Page 31: Programming Language Concepts (CIS 635)](https://reader036.vdocuments.us/reader036/viewer/2022062518/56814853550346895db565ba/html5/thumbnails/31.jpg)
Copyright 2002 Elsa L. Gunter
Language Paradigms – Logic Programming
• Rule-based languages– Programs as sets of basic rules for
decomposing problem– Computation by deduction: search,
unification and backtracking main components
– Syntax: Answer :- specification rule– Example languages: (Prolog,
Datalog,BNF Parsing)