Download
cse 321 programming languages overview n.
Skip this Video
Loading SlideShow in 5 Seconds..
CSE-321 Programming Languages Overview PowerPoint Presentation
Download Presentation
CSE-321 Programming Languages Overview

CSE-321 Programming Languages Overview

1 Vues Download Presentation
Télécharger la présentation

CSE-321 Programming Languages Overview

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CSE-321 Programming LanguagesOverview 박성우 POSTECH March 6, 2006

  2. Welcome! • What this course is about: • fundamental theory behind programming languages • and all other exciting topics • What this course is not about: • history of programming languages • comparison of different programming paradigms • and all other boring topics (that you can study by yourself)

  3. PLs you have ever used? • BASIC • Pascal • Assembly languages • C • C++ • Java • C# • Prolog • Lisp • Perl • Python • ... • any other?

  4. BASIC • 1984 • Disappointing ;-( • It does not compile to machine code. • It is slow. • “So I cannot make a computer game!” • Had to learn anyway: • to run computer games stored in cassette tapes

  5. C • 1991 • Exciting ;-) • It compiles to machine code. • “So maybe I can make a computer game!” • “Return of the Jedi” (1983) and DOOM (1993)

  6. I did not realize how inefficient my structural programming was until ...

  7. C++ • 1993 • Cool! • object-orientation (whatever that means) • Even a novice programmer like me instantly appreciated the power of object-orientation. • Remark by the instructor: “C++ will become the most dominant programming language in a decade from now.” • Is it?

  8. I did not realize how inefficient my object-oriented programming was until ...

  9. Java • 1995 • Incredible! • Not only object-orientation but also garbage collection! • no more hassle of memory allocation and deallocation • Virtual Machine lets you run the code “everywhere.” • The syntax and semantics seemed flawless.

  10. I did not realize how ugly,inelegant, and messymy Java programming was until ... (to be continued)

  11. Outline • Introduction V • Why do we need to study programming language theory? • What do we study in programming language theory? • How do we study programming language theory? • Summary

  12. Mars Climate Orbiter Failure • Mars Climate Orbiter launched in 1998 • Destroyed due to a navigation error • Cause? • One module used English units (feet). • The other module expected metric units (meter). • Lessons • Both modules were fine in isolation. • Programmers did not even know the existence of the bug until the spacecraft was destroyed. • Stupidity: • NASA scientists? No! • programming languages they used? Yes!

  13. Robot Programming?

  14. Communication map unit map unit centimeter/radian mapper navigator meter/degree meter/degree localizer sensor processor actuator Robot Programming • Dimension conversion

  15. Robot Programming • Probabilistic computation

  16. Programming Language CES • C++ for Embedded Systems • Story: • Robot programming in C++ is too painful. • It is quite prone to errors. • It is very hard to locate errors even if we know their existence. • E.g., no segmentation fault, but the robot takes a wrong path. • So why not design a new programming language? • Lesson • It is not programming language theorists who wanted to develop CES. • It is a robotics expert who wanted such a language (who won the DARPA Grand Challenge!)

  17. Anyone recognizes this picture?

  18. Gears of War • Highly anticipated XBox 360 Killer title by Epic Games

  19. Gears of War at POPL 2006 • POPL (Principles of Programming Languages) • the premier conference for programming language research • Tim Sweeney • CEO and founder of Epic Games • Epic Games? • Unreal Tournament series • Gears of War • Unreal Engine (used in Lineage II) • Tim Sweeney gave an invited talk entitled: “The next mainstream programming language: a game developer's perspective”

  20. Gist of the Talk • Code: • gameplay code: ~250,000 lines C++ code • Unreal Engine 3: ~250,000 lines C++ code • “Will gladly sacrifice 10% of our performance for 10% higher productivity.” • Our code is littered with runtime failure cases, yet the compiler remains silent! • By 2009, game developers will face… • CPU’s with: • 20+ cores • 80+ hardware threads • >1 TFLOP of computing power • If we are to program these devices productively, you are our only hope!

  21. VAULT at Microsoft • Microsoft believes: • 90% of Windows OS bugs originate from “device drivers.” • Device drivers account for 70% of Windows OS source code. • Microsoft cannot verify: • these 90% of Windows OS bugs indeed originate from “device drivers.” • So they are designing a new language called VAULT: • type system that enforces rules between device drivers and the OS kernel.

  22. Outline • Introduction V • Why do we need to study programming language theory? V • What do we study in programming language theory? • How do we study programming language theory? • Summary

  23. What to Study? • 1st topic: • type theory • 2nd topic: • operational semantics • 3rd topic: • logic • What the heck is type theory anyway?

  24. Long Documentation • Long documentation is always better? /* Takes two arguments and returns their sum. * Both arguments must be integers. * If not, the result is unpredictable. * If their sum is too large, an overflow may occur. * ... */ fun add(x, y) { return x + y; } • The documentation cannot be formally verified by the compiler. • We have to trust whoever wrote it.

  25. Short Documentation • Short documentation can be formally verified by the compiler. • Great! argnum 2 fun add(x, y) { return x + y; } • Utterly useless, however ;-(

  26. Types • Good compromise between: • simplicity: types can be formally verified. • expressiveness: types are useful. int add(int x, int y) { return x + y; } • I will spend the whole semester to convince you that type theory is: • useful, • beautiful with a strong logical foundation, • and fun to learn.

  27. Outline • Introduction V • Why do we need to study programming language theory? V • What do we study in programming language theory? V • How do we study programming language theory? • Summary

  28. I did not realize how ugly,inelegant, and messymy Java programming was until ... (from an earlier slide)

  29. Anyone recognizes this picture?

  30. Familiar?

  31. ML Programming Language

  32. ML • 1995 • Eye-opener! • functional language • strong type system • profound logical foundation • ML = “Meta-Language” • Lessons that I learned: • Programming is not about coding. • Programming is about design and specification.

  33. Outline • Introduction V • Why do we need to study programming language theory? V • What do we study in programming language theory? V • How do we study programming language theory? V • Summary

  34. Summary • Why do we need to study programming language theory? • Because there is an ever growing need for new programming languages! • What do we study in programming language theory? • Type theory and operational semantics! • How do we study programming language theory? • By learning a functional language ML and its foundation!

  35. RoboCup 2050 Still in C++, Python? http://www.robocup.org

  36. Homework by Wednesday • Visit the course webpage. • http://www.postech.ac.kr/~gla/cs321 • Install SML/NJ 110.57 on your machine. • Install the AFS client software on your machine. • make sure you have read/write permission on your submission directory. • Read Chapter 1 of the course notes. • Any comments will be greatly appreciated. • Start assignment 1!