DOC PREVIEW
Berkeley COMPSCI 164 - Lecture 1 Course Introduction

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 1: Course Introduction AdministriviaCourse StructurePlagiarism: Obligatory WarningProjectImplementing Programming LanguagesLanguagesFORTRANAfter FORTRANThe Language ExplosionThe 1970sInto the PresentExample: FORTRANExample: Algol 60Example: APLExample: PrologProblems to AddressClassical Compiler Structure (Front)Classical Compiler Structure (Back)Lecture 1: Course IntroductionCS164: Programming Languages and CompilersP. N. Hilfinger, 787 SodaSpring 2009Acknowledgement. Portions taken from CS164 notes by G. Necula.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 1Administrivia• All course information, readings, and documentation is online fromthe course web page (constantly under construction).RTFM!• Pick up class accounts in lecture today or Thursday. Please do nottry to log in with your account until Wednesday, 20 Jan.• Projectsrequire2–3 partners. Start looking.• I’ll try to get wait list processed this week.• No section meetings this week.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 2Course Structure• Lectures, discussions intended to discuss and illustrate materialthat you havepreviously read.• For Thursday, please read Chapter 2 of the Course Notes.• Regular homework does theory, practical “finger exercises.” Doneindividually.• Projects are long programming assignments, done in teams.• All submissions electronic.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 3Plagiarism: Obligatory Warning• We have software to detect plagiarism, and we Know How to Use It!• If you must use others’ work (in moderation),cite it!• Remember that on projects, you necessarily involve your partner.• Most cheating cases result from time pressure. Keep up, andtalktous as early as possible about problems.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 4Project• Hidden agenda: programming design and experience.• Substantial project in modules.• Provides example of how complicated problem might be approached.• Validation (testing) part of project.• Chance to use version control for real.• And this semester (shudder) C++.• General rule: start early!Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 5Implementing Programming Languages• Strategy 1: Interpreter: program that runs programs.• Strategy 2: Compiler: program that translates program into machinecode (interpreted by machine).• Modern trend is hybrid:– Compilers that produce virtual machine code forbytecode inter-preters.– “Just-In-Time” (JIT) compilers interpret parts of program, com-pile other parts during execution.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 6Languages• Initially, programs “hard-wired” or entered electro-mechanically– Analytical Engine, Jacquard Loom, ENIAC, punched-card-handlingmachines• Next, stored-program machines: programs encoded as numbers (ma-chine language) and stored as data:– Manchester Mark I, EDSAC.• 1953: IBM develops the 701; all programming done in assembly• Problem: Software costs > hardware costs!• John Backus: “Speedcoding” made a 701 appear to have floatingpoint and index registers. Interpreter ran 10–20 times slower thannative code.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 7FORTRAN• Also due to John Backus (1954–7).• Revolutionary idea at the time: convert high-level (algebraic formu-lae) to assembly.• Called “automatic programming” at the time. Some thought it impos-sible.• Wildly successful: language could cut development times from weeksto hours; produced machine code almost as good as hand-written.• Start of extensive theoretical work (and Fortran is still with us!).Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 8After FORTRAN• Lisp, late 1950s: dynamic, symbolic data structures.• Algol 60: Europe’s answer to FORTRAN: modern syntax, block struc-ture, explicit declaration.– Dijkstra: “A marked improvement on its successors.”– Algol report Set standard for language description.• COBOL: late 1950’s (and still with us). Business-oriented. Intro-duces records (structs).Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 9The Language Explosion• APL (arrays), SNOBOL (strings), FORMAC (formulae), and manymore.• 1967-68: Simula 67, first "object-oriented" language.• Algol 68: Combines FORTRANish numerical constructs, COBOLishrecords, pointers, all described in rigorous formalism. Remnantsremain in C, but Algol68 deemed too complex.• 1968: "Software Crisis" announced. Trend towards simpler lan-guages: Algol W, Pascal, CLast modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 10The 1970s• Emphasis on “methodology”: modular programming, CLU, Modula fam-ily.• Mid 1970’s: Prolog. Declarative logic programming.• Mid 1970’s: ML (Metalanguage) type inference, pattern-driven pro-gramming. (Led to Haskell, OCaml).• Late 1970’s: DoD starts to develop Ada to consolidate >500 lan-guages.Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 11Into the Present• Complexity increases with C++.• Then decreases with Java.• Then increases again (C#, Java 1.5).• Proliferation of little or specialized languages and scripting languages:HTML, PHP, Perl, Python, Ruby, . . . .Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 12Example: FORTRANC FORTRAN (OLD-STYLE) SORTING ROUTINECSUBROUTINE SORT (A, N)DIMENSION A(N)IF (N - 1) 40, 40, 1010 DO 30 I = 2, NL = I-1X = A(I)DO 20 J = 1, LK = I - JIF (X - A(K)) 60, 50, 50C FOUND INSERTION POINT: X >= A(K)50 A(K+1) = XGO TO 30C ELSE, MOVE ELEMENT UP60 A(K+1) = A(K)20 CONTINUEA(1) = X30 CONTINUE40 RETURNENDC ----------------------------------C MAIN PROGRAMDIMENSION Q(500)100 FORMAT(I5/(6F10.5))200 FORMAT(6F12.5)READ(5, 100) N, (Q(J), J = 1, N)CALL SORT(Q, N)WRITE(6, 200) (Q(J), J = 1, N)STOPENDLast modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 13Example: Algol 60comment An Algol 60 sorting program;procedure Sort (A, N)value N;integer N; real array A;beginreal X;integer i, j;for i := 2 until N do beginX := A[i];for j := i-1 step -1 until 1 doif X >= A[j] then beginA[j+1] := X; goto Foundend elseA[j+1] := A[j];A[1] := X;Found:endendend SortLast modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 14Example: APL∩◦An APL sorting program∇Z←SORT AZ←A[△|A]∇Last modified: Mon Feb 23 14:35:15 2009 CS164: Lecture #1 15Example: Prolog/* A naive Prolog sort *//* permutation(A,B) iff list B is apermutation of list A.


View Full Document

Berkeley COMPSCI 164 - Lecture 1 Course Introduction

Documents in this Course
Lecture 8

Lecture 8

40 pages

Load more
Download Lecture 1 Course Introduction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 1 Course Introduction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 1 Course Introduction 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?