1 introduction programming language design and implementation (4th edition) by t. pratt and m....
TRANSCRIPT
![Page 1: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/1.jpg)
1
Introduction
Programming Language Design and Implementation (4th Edition)by T. Pratt and M. Zelkowitz
Prentice Hall, 2001
Sections 1-1.3.2
![Page 2: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/2.jpg)
2
Organization of Programming Languages
• Understand how languages are designed and implemented
• Syntax -- What a program looks like• Semantics -- What a program means• Implementation -- How a program executes
• Understand most appropriate language for solving specific problems, For example:
• Pascal, C -- procedural, statement oriented• C++, Java, Smalltalk -- Object oriented• ML, Lisp -- Functional • Prolog -- Rule-based
![Page 3: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/3.jpg)
3
Language Goals
• During 1950s--1960s - Compile programs to execute efficiently.
• There is a direct connection between language features and hardware - integers, reals, goto statements
• Programmers cheap; Machines expensive; Keep the machine busy
• But today• Compile programs that are built efficiently• CPU power and memory very cheap• Direct connection between language features and desi
gn concepts - encapsulation, records, inheritance, functionality, assertions
![Page 4: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/4.jpg)
4
Era Application Majorlanguages
Otherlanguages
Business COBOL AssemblerScientific FORTRAN Algol, BASIC,
APLSystem Assembler JOVIAL, Forth
1960s
Artificialintelligence
LISP SNOBOL
Business COBOL, C++,Java, spreadsheet
C, PL/I, 4GLs
Scientific FORTRAN, C,C++, Java
BASIC
System C, C++, Java Ada, BASIC,Modula
Artificialintelligence
LISP, Prolog
Publishing TeX, Postscript,word processing
Process UNIX shell, TCL,Perl, Javascript
AWK, Marvel,SED
Today
New paradigms ML, Smalltalk Eiffel
![Page 5: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/5.jpg)
5
Why study programming languages? (1)
• To improve your ability to develop effective algorithms
Improper use of recursion
Object-oriented programming, logic programming, concurrent programming
• To improve your use of your existing programming language
Data structures for arrays, strings, lists, records
Malloc() garbage collection
Implementation details of recursion, object classes, subroutine calls, …
![Page 6: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/6.jpg)
6
Why study programming languages? (2)
• To increase your vocabulary of useful programming constructs
Increase programming vocabulary and its implementation tech.
Coroutine • To allow a better choice of programming language
Numeric computation : C, FORTRAN, Ada
AI : LISP, Prolog
Internet applications : Perl, Java
![Page 7: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/7.jpg)
7
Why study programming languages? (3)
• To make it easier to learn a new language• To make it easier to design a new language
User interface design
• *** C, COBOL, SMALLTALK 의 덧셈의 속도차이
![Page 8: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/8.jpg)
8
Evolution of software architecture
• 1950s - Large expensive mainframe computers ran single programs (Batch processing)
• 1960s - Interactive programming (time-sharing) on mainframes
• 1970s - Development of Minicomputers and first microcomputers. Apple II. Early work on windows, icons, and PCs at XEROX PARC
• 1980s - Personal computer - Microprocessor, IBM PC and Apple Macintosh. Use of windows, icons and mouse
• 1990s - Client-server computing - Networking, The Internet, the World Wide Web
• 2000s - ??? P2P
![Page 9: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/9.jpg)
9
Attributes of a good language (1)
• Clarity, simplicity, and unity - provides both a framework for thinking about algorithms and a means of expressing those algorithms
Conceptual integrity
APL
SNOBOL4• Orthogonality -every combination of features is mean
ingful
Fewer exceptions
Logical errors and inefficiency
![Page 10: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/10.jpg)
10
![Page 11: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/11.jpg)
11
![Page 12: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/12.jpg)
12
Attributes of a good language(2)
• Naturalness for the application - program structure reflects the logical structure of algorithm
Sequential algorithm, concurrent algorithm, logic algorithm, non-deterministic algorithm
Appropriate data structures, operations, control structures, natural syntax
• Support for abstraction - program data reflects problem being solved
Data abstraction <D,O,C>
Encapsulation
![Page 13: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/13.jpg)
13
Attributes of a good language (3)
• Ease of program verification - verifying that program correctly performs its required function Verification/validationComments, assert()Design specification
• Programming environment - external support for the languageDebugger, syntax-directed editorSupporting function, platformsSmalltalk Supporting all the software lifecycle phases
![Page 14: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/14.jpg)
14
Attributes of a good language (continued)
• Portability of programs - transportability} of the resulting programs from the computer on which they are developed to other computer systems
Transportability
C, C++, Pascal Java
ML : single source implementation• Cost of use - program execution, program translatio
n, program creation, and program maintenance
Code optimization, (Smalltalk, Perl), lifecycle costs
![Page 15: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/15.jpg)
15
Language paradigms
• Imperative languages • Goal is to understand a machine state (set of memory
locations, each containing a value)• Statement oriented languages that change machine sta
te (C, Pascal, FORTRAN, COBOL)• Syntax: S1, S2, S3, ...
• Applicative (functional) languages• Goal is to understand the function that produces the
answer• Function composition is major operation (ML, LISP)• Syntax: P1(P2(P3(X)))• Programming consists of building the function that c
omputes the answer
![Page 16: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/16.jpg)
16
![Page 17: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/17.jpg)
17
![Page 18: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/18.jpg)
18
![Page 19: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/19.jpg)
19
Language paradigms (continued)
• Rule-based languages• Specify rule that specifies problem solution (Prolo
g, BNF Parsing)• Other examples: Decision procedures, Grammar rules
(BNF)• Syntax: Answer specification rule• Programming consists of specifying the attributes of
the answer
• Object-oriented languages• Imperative languages that merge applicative design w
ith imperative statements (Java, C++, Smalltalk)• Syntax: Set of objects (classes) containing data (im
perative concepts) and methods (applicative concepts)
![Page 20: 1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections 1-1.3.2](https://reader036.vdocuments.site/reader036/viewer/2022062409/56649ebd5503460f94bc6dab/html5/thumbnails/20.jpg)
20