Title: Proof of Correctness? ??
1?? ?? ? ??
- ????
- Proof of Correctness? ??
- Lambda Calculus Python? ???? ?? ??
- ??? 2??? ???? 1? ??, term project? ??, ? ?? ????
? ?? ?? ?? - ??
- ??, ?? ? 12? ??? ????
- ??? 75?(1430-1545), ?? ???? ??
2????
- Http//borame.cs.pusan.ac.kr/lecture
- ?????? (??)
- 2002? ?? ??
- 2002? ???, ?? ????
- 2003, 2004, 2005, 2006, 2007, 2008, 2009?, 2010,
2011, 2012? ???? - ?? ???, ??, ?? ?? ??(??) ??
- ?? ?? ??? ? ?? ??? ??? ????? ?? ???? ??? ? ??
3???? ??
- ??? ?? ???? ??? ???? ??? ?????
- ?????? ???? ? ?? ??? ?? ??? ???? ????, ???? ???
(??? ????? ??) - ?? ?????? ???? ??
- high-level data types built in, such as flexible
arrays and dictionaries - ???? ??? ?? ??? ???? ???, ??? ?????
- Runtime checking? ???
4????? ??, ?? ?? ???
- Paul Graham? "Revenge of the Nerds"? "Beating for
average"?? ??? ??? ?????, ????? ? ??? ? ??? ???
??? ??? ?? ??? ???? ??? ??? ????? ??? ????, ???
????? ??? ????? ??? ??? ? ??? ??? ??.?, ??? ? ??
??? ?? ??? ??? ???? ??? ? ??? ??? ????. - GitHub JavaScript, Ruby, Python, PHP, Java, C,
C, Perl, C, Objective C - StackOverflow C, Java, PHP, JavaScript, C,
Python, Objective-C, C, Ruby, Perl, Delphi
5????? ?? ?? ?? (Script ?? ??)
- Tiobe.com (Skilled Engineer)
- Java 19.1
- C 15.2
- C 10.1
- PHP 8.7
- Visual Basic 8.4
- Perl 6.2
- Python 3.8
- C 3.7
- JavaScript 3.1
- Ruby 2.6
- Delphi 2.1
- Dice.com (2006?)
- Java 35.7
- C, C 15.3
- C 12.7
- Perl 11.9
- JavaScript 10.9
- Visual Basic .NET 5.2
- PHP 2.9
- Ajax 2.7
- Python 2.0
- Ruby 0.7
6? ????? ???? ????
- ??? ????? ?? ? ??? ?? ??? ?? ?? ? ? ?? ??
- ???? ????? ??? ??? ???? ?? ????? ??? ? ?? ?
- ???? ????? ??? ??? ??? ??? ???? ??
- ????? ?? ? ???? ??? ??
7????
- ??? ???? ??!! ??? ???? ??!!
- ??? ??(Object), ??? ??, ???
- ??? ??, ??
- ??? ??? ?? ??? ??? ???, ??? ???? ???
- ????? ???
- ??????? !!
- ??? ??? ???? ??? ? ?? ???? ??
- ??? ??? ?? ??(??? ??? ??)
- ??? ?? ????? ?? ? ???, ??? 1,000? ? ?? ????? ?? ?
??. (?? ??) - ??? ?? ?? ??? ???? ????
- ??? ??? ???? ?? ????? ??? ?????? ??
- ??? ??? ??? ???? ? (?? ????? ? ???)
8Organization of Programming Languages
- Understand how languages are designed and
implemented - ??
- Lexicon What sorts of words are legal?
- Syntax -- What a program looks like?
- Semantics -- What a program means?
- Pragmatics ?? ???? ??? C??? int?
- ?? ?? ??
- ????, ??, ???? ? ??
- ????, keywords, ??
- ????? ???? ??
- ??? ??? ? ??
- Implementation -- How a program executes
9????? ??? ??
- Understand most appropriate language for solving
specific problems, For example - Pascal, C, Perl -- procedural, statement oriented
- C, Java, Smalltalk -- Object oriented
- ML, Lisp -- Functional
- Prolog -- Rule-based
- JavaScript, PHP, ASP.net, C Procedural,
Event-driven accessing
10Language 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
design concepts - encapsulation, records,
inheritance, functionality, assertions - Event-driven programming, Service-oriented
approach, Web-service, Very High-level Language
11Python
- Python is a general-purpose, high-level
programming language. Its design philosophy
emphasizes programmer productivity and code
readability. Python's core syntax and semantics
are minimalist, while the standard library is
large and comprehensive. - Python supports multiple programming paradigms
(primarily functional, object oriented and
imperative), and features a fully dynamic type
system and automatic memory management it is
thus similar to Perl, Ruby, Scheme, and Tcl. - Python was first released by Guido van Rossum in
1991.3 The language has an open,
community-based development model managed by the
non-profit Python Software Foundation. While
various parts of the language have formal
specifications and standards, the language as a
whole is not formally specified. The de facto
standard for the language is the CPython
implementation.
12(No Transcript)
13Why 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, set, bag, table (associative array) - Malloc() ? garbage collection
- Implementation details of recursion, object
classes, subroutine calls, exception(event)
handling - Service-oriented developing
- Web-service, Semantic web, Script language
14Why study programming languages? (2)
- To increase your vocabulary of useful programming
constructs - Increase programming vocabulary and its
implementation tech. - Coroutine, Semaphore, event-driven programming,
associative array - Named parameter (keyword argument) (Ada, Python,
Smalltalk, Common Lisp) - Name mangling (name decoration) _Z on C, C
- Filename mangling Unix file names can contain
colons or backslashes - To allow a better choice of programming language
- Numeric computation C, FORTRAN, Ada
- AI LISP, Prolog
- Internet applications Perl, Java, HTML, XML,
Web Service(SOAP), PHP, ASP.net, Python
15Why study programming languages? (3)
- To make it easier to learn a new language
- Web programming (JavaScript, PHP), Semantic web
- Python
- To make it easier to design a new language
- User interface design
- C, COBOL, SMALLTALK? ??? ????? ???? ???? ?
??? ??
16Evolution 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, Grid Computing, Web Service,
Event-driven approach, Service-oriented
programming, Script language, Cloud Computing
17Attributes 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
meaningful - Fewer exceptions ? C???? !!!
- Logical errors and inefficiency
18(No Transcript)
19(No Transcript)
20Attributes 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 ltD,O,Cgt
- Encapsulation
21Attributes of a good language (3)
- Ease of program verification - verifying that
program correctly performs its required function - Verification/validation
- standard, or specification requirements
- the needs of the intended end-user or customer
- Comments, assert()
- Design specification
- Programming environment - external support for
the language - Debugger, syntax-directed editor
- Supporting function, platforms
- Smalltalk
- Supporting all the software lifecycle phases
22Attributes 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 (Byte-code)
- ML single source implementation
- Cost of use - program execution, program
translation, program creation, and program
maintenance - Code optimization, (Smalltalk, Perl), lifecycle
costs
23Language paradigms
- Imperative languages
- Goal is to understand a machine state (set of
memory locations, each containing a value) - Statement oriented languages that change machine
state (C, Pascal, FORTRAN, COBOL, C, Java) - 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 computes the answer
24(No Transcript)
25example1.f
- 234567 example1.f
- A tiny program to plot my running times
using GrADS
-
- PARAMETER(NDAYS365, UNDEF-9.99,
EMPTY0.00) - C
- REAL MIN(NDAYS)
- DIMENSION SEC(NDAYS)
- C
- CHARACTER27 HEADER
- CHARACTER3 DAY
- CHARACTER28 PATH
- C
- PATH'/data/temp4/alfredo/fortran/'
- C
- OPEN(1,FILEPATH//'runtimes.data',FORM'FORM
ATTED', - - STATUSOLD')
Changing to REAL
Nonexecutable
Sequential (by default)
26example1.f
Undefined value
- READ (1,2) HEADER
- WRITE(,2) HEADER
- WRITE(,2) '----------------------------'
- C
- ND 0
- 1 CONTINUE
- ND ND1
- READ (1,3,END4) DAY,DATE,MIN(ND),SEC(ND)
- WRITE(,3) DAY,DATE,MIN(ND),SEC(ND)
- IF((MIN(ND).EQ.EMPTY).AND.(SEC(ND).EQ.EMP
TY)) GO TO 4 - GO TO 1
- 4 CONTINUE
- ND ND - 1 !Taking away the last line
because is blank - CLOSE(1)
- 3 FORMAT(A3,2X,I8,2X,F5.2,2X,F5.2)
- WRITE(,)'---------------------------------
----------' - WRITE(,)'I AM RUNNING SINCE JULY 1,
2002!!!!!' - WRITE(,)'THAT IS',ND,' DAYS AGO'
- C
runtimes.data DAY DATE MIN
SEC MON 01072002 -9.99 -9.99 TUE 02072002
-9.99 -9.99 WED 03072002 19.00 43.00 THU
04072002 19.00 33.00 FRI 05072002 19.00
33.00 SAT 06072002 19.00 27.00 SUN 07072002
-9.99 -9.99 MON 08072002 19.00 46.00
. . . TUE 15102002 29.00 7.00 WED 16102002
-9.99 -9.99 THU 17102002 FRI 18102002 SAT
19102002 SUN 20102002 MON 21102002 TUE
22102002 WED 23102002 THU 24102002 FRI
25102002 SAT 26102002 SUN 27102002
No value
27example1.f
- OPEN(2,FILEPATH//'runtimes_gr.data',ACCESS
'DIRECT', - - STATUS'UNKNOWN',FORM'UNFORMATTED',R
ECL1) - C
- NDNOR 0
- NDSIR 0
- DO N 1, ND
- IF((MIN(N).EQ.UNDEF).OR.(SEC(N).EQ.UNDEF)
) THEN - TIME UNDEF
- NDNOR NDNOR 1
- ELSE
- TIME MIN(N)SEC(N)/60.
- NDSIR NDSIR 1
- ENDIF
- WRITE(2,RECN) TIME
- ENDDO
-
28example1.f
- WRITE(2,RECND1) UNDEF !Just adding 1 and
2 extra - WRITE(2,RECND2) UNDEF !blank lines for
plotting purposes - CLOSE(2)
- WRITE(,)'WELL,',NDSIR,' DAYS LEAVING FOR
A RUN' - WRITE(,)'AND',NDNOR,' DAYS JUST BEING
LAZY' - WRITE(,)'---------------------------------
----------' - WRITE(,)'make ',ND2,' days in the script
file' - WRITE(,)'grads -blc "run runtimes.gs"'
- C
- 2 FORMAT(A27)
- C
- C f77 example1.f
- C ./a.out
- END
29COBOL II
- 000010 IDENTIFICATION DIVISION.
- 000020 PROGRAM-ID. SAMPLE.
- 000030 AUTHOR. J.P.E. HODGSON.
- 000040 DATE-WRITTEN. 4 February 2000
- 000041
- 000042 A sample program just to show the form.
- 000043 The program copies its input to the
output, - 000044 and counts the number of records.
- 000045 At the end this number is printed.
- 000046 000050 ENVIRONMENT DIVISION.
- 000060 INPUT-OUTPUT SECTION.
- 000070 FILE-CONTROL.
- 000080 SELECT STUDENT-FILE ASSIGN TO
SYSIN - 000090 ORGANIZATION IS LINE
SEQUENTIAL. - 000100 SELECT PRINT-FILE ASSIGN TO
SYSOUT - 000110 ORGANIZATION IS LINE
SEQUENTIAL.
30COBOL II
- 000120
- 000130 DATA DIVISION.
- 000140 FILE SECTION.
- 000150 FD STUDENT-FILE
- 000160 RECORD CONTAINS 43 CHARACTERS
- 000170 DATA RECORD IS STUDENT-IN.
- 000180 01 STUDENT-IN PIC X(43).
- 000190
- 000200 FD PRINT-FILE
- 000210 RECORD CONTAINS 80 CHARACTERS
- 000220 DATA RECORD IS PRINT-LINE.
- 000230 01 PRINT-LINE PIC X(80).
- 000240
- 000250 WORKING-STORAGE SECTION.
- 000260 01 DATA-REMAINS-SWITCH PIC X(2) VALUE
SPACES. - 000261 01 RECORDS-WRITTEN PIC 99.
- 000270
31COBOL III
- 000270
- 000280 01 DETAIL-LINE.
- 000290 05 FILLER PIC X(7) VALUE SPACES.
- 000300 05 RECORD-IMAGE PIC X(43).
- 000310 05 FILLER PIC X(30) VALUE
SPACES. - 000311
- 000312 01 SUMMARY-LINE.
- 000313 05 FILLER PIC X(7) VALUE SPACES.
- 000314 05 TOTAL-READ PIC 99.
- 000315 05 FILLER PIC X VALUE SPACE.
- 000316 05 FILLER PIC X(17) VALUE
'Records were read'. - 000318 05 FILLER PIC X(53) VALUE SPACES.
- 000319
32COBOL IV
- 000320 PROCEDURE DIVISION.
- 000330 PREPARE-SENIOR-REPORT.
- 000340 OPEN INPUT STUDENT-FILE.
- 000350 OUTPUT PRINT-FILE.
- 000351 MOVE ZERO TO RECORDS-WRITTEN.
- 000360 READ STUDENT-FILE
- 000370 AT END MOVE 'NO' TO
DATA-REMAINS-SWITCH. - 000380 END-READ.
33(No Transcript)
34(No Transcript)
35Language paradigms (continued)
- Rule-based languages
- Specify rule that specifies problem solution
(Prolog, 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 with imperative statements (Java, C,
Smalltalk) - Syntax Set of objects (classes) containing data
(imperative concepts) and methods (applicative
concepts)
36(No Transcript)
37New Paradigm
- Internet, Home Computing, Ubiquitous Computing,
Embedded Computing, etc - Languages and Compilers that are smart, small and
safe - Moveable code ? agents
- Independent from machines and programming
environments - Supporting pragmatics or intelligence
- Java, XML, Mobile computing. Mobile code
- Event driven approach, Service-oriented
Architecture, Web Service - Supports multiple paradigms Python
- ??? ????, ?????? ??? ???? ???? ???? ??? ??? ????
??? ?????? ???? ??
38??? ????!!
- (1) Orthogonality? C???? ???? ? ?? ??? ?? ???!
- (2)??? ???? ??? ? ????? ??? ??????
- (3) ????? ?????? Platform?? ?? ????? ??.
Platform?? ????, ?? ??????? ?? ??? ???? ?? ??
??? smartphone platform? ????, ? platform? ??? ?
??? ???????? ???????(?)? ?? ??? ?? ? ?? ??? ????.