1 / 14

Midterm Review

CS 242. Midterm Review. TA Help Session. Midterm Exam Wednesday Oct 26 7:00 – 9:00 PM Gates B01. Today’s Outline. Brief Introduction/Review of course so far Review final slides ~10-15 mins Help stimulate useful questions Office Hours on steroids

rance
Download Presentation

Midterm Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 242 Midterm Review TA Help Session Midterm Exam Wednesday Oct 26 7:00 – 9:00 PM Gates B01

  2. Today’s Outline • Brief Introduction/Review of course so far • Review final slides • ~10-15 mins • Help stimulate useful questions • Office Hours on steroids • All of the TA’s will be available to answer questions • Note: No section Friday

  3. Summary of the course • Lisp • Computability • Fundamentals • lambda calculus • functional prog • ML and type systems • Block structure and activation records • Exceptions • Scripting Lang/DSL’s

  4. Lisp Summary • Successful language • Symbolic computation, experimental programming • Specific language ideas • Expression-oriented: functions and recursion • Lists as basic data structures • Programs as data, with universal function eval • Stack implementation of recursion via "public pushdown list" • Idea of garbage collection.

  5. Fundamentals • Grammars, parsing • Lambda calculus • Functional vs. Imperative Programming • Is implicit parallelism a good idea? • Is implicit anything a good idea?

  6. Algol Family and ML • Evolution of Algol family • Recursive functions and parameter passing • Evolution of types and data structuring • ML: Combination of Lisp and Algol-like features • Expression-oriented • Higher-order functions • Garbage collection • Abstract data types • Module system • Exceptions

  7. Types and Type Checking • Types are important in modern languages • Program organization and documentation • Prevent program errors • Provide important information to compiler • Type inference • Determine best type for an expression, based on known information about symbols in the expression • Polymorphism • Single algorithm (function) can have many types • Overloading • Symbol with multiple meanings, resolved at compile time

  8. Block structure and storage mgmt • Block-structured languages and stack storage • In-line Blocks • activation records • storage for local, global variables • First-order functions • parameter passing • tail recursion and iteration • Higher-order functions • deviations from stack discipline • language expressiveness => implementation complexity

  9. Summary of scope issues • Block-structured lang uses stack of activ records • Activation records contain parameters, local vars, … • Also pointers to enclosing scope • Several different parameter passing mechanisms • Tail calls may be optimized • Function parameters/results require closures • Closure environment pointer used on function call • Stack deallocation may fail if function returned from call • Closures not needed if functions not in nested blocks

  10. Control • Structured Programming • Go to considered harmful • Exceptions • “structured” jumps that may return a value • dynamic scoping of exception handler • Continuations • Function representing the rest of the program • Generalized form of tail recursion

  11. Scripting Language Upsides • Optimize for people, not machines • Principle of Least Surprise (after you know the language well…) • There’s more than one way to do it (TMTOWTDI, pronounced Tim Toady) • No built-in limits • Make common things short • Make easy tasks easy and hard tasks possible • Executable pseudo-code

  12. Scripting Language downsides… • “Write once, read never” • Perl in particular seems to facilitate writing difficult to read programs. A consequence of TMTOWDI? • Performance can be difficult to predict • Fast: regular expression processing • Slow: threads • Shell calls? • Errors are detected dynamically

  13. Domain Specific Langs Summary • All languages have a domain. • Languages provide a rich interface to computers. • Tailored abstractions are powerful: • support domain experts • make code more reliable (shorter: boring code is generated) • Less is more • Extra reasoning principles & more optimization opportunities • Two for one specials • Executable, verification support, auxiliary tools, … • Languages are constantly being designed, implemented, and used.

  14. Questions? • Remember: Midterm Exam • Wednesday Oct 26 (Tonight) • 7:00 – 9:00 PM • Gates B01 (this room) • Closed Book, Closed Notes

More Related