Содержание
- 2. slide Reading Assignment Mitchell, Chapter 2.1
- 3. slide What Is a Programming Language? Formal notation for specifying computations, independent of a specific machine
- 4. slide Partial and Total Functions Value of an expression may be undefined Undefined operation, e.g., division
- 5. slide Partial and Total: Definitions Total function f:A→B is a subset f ⊆ A×B with ∀
- 6. slide Computability Function f is computable if some program P computes it For any input x,
- 7. slide Halting Problem Ettore Bugatti: "I make my cars to go, not to stop"
- 8. slide Halting Function Decide whether program halts on input Given program P and input x to
- 9. slide Unsolvability of the Halting Problem Suppose P solves variant of halting problem On input Q,
- 10. slide Main Points About Computability Some functions are computable, some are not Example: halting problem Programming
- 11. slide Computation Rules The factorial function type declaration does not convey how the computation is to
- 12. slide Factorial Functions C, C++, Java: int fact (int n) { return (n == 0) ?
- 13. slide Principal Paradigms Imperative / Procedural Functional / Applicative Object-Oriented Concurrent Logic Scripting In reality, very
- 14. slide Where Do Paradigms Come From? Paradigms emerge as the result of social processes in which
- 15. slide Imperative Paradigm Imperative (procedural) programs consists of actions to effect state change, principally through assignment
- 16. slide Functional and Logic Paradigms Focuses on function evaluation; avoids updates, assignment, mutable state, side effects
- 17. slide Concurrent and Scripting Languages Concurrent programming cuts across imperative, object-oriented, and functional paradigms Scripting is
- 18. slide Unifying Concepts Unifying language concepts Types (both built-in and user-defined) Specify constraints on functions and
- 19. slide Design Choices C: Efficient imperative programming with static types C++: Object-oriented programming with static types
- 20. slide Abstraction and Modularization Re-use, sharing, extension of code are critically important in software engineering Big
- 21. slide Static vs. Dynamic Typing Static typing Common in compiled languages, considered “safer” Type of each
- 22. slide Billion-Dollar Mistake Failed launch of Ariane 5 rocket (1996) $500 million payload; $7 billion spent
- 23. slide Program Correctness Assert formal correctness statements about critical parts of a program and reason effectively
- 24. slide Native-code compiler: produces machine code Compiled languages: Fortran, C, C++, SML … Interpreter: translates into
- 25. slide Language Compilation Compiler: program that translates a source language into a target language Target language
- 26. slide Checks During Compilation Syntactically invalid constructs Invalid type conversions A value is used in the
- 27. slide Compilation Process Lexical analyzer raw source code text Syntax analyzer + type checker tokens ASTs
- 28. slide Phases of Compilation Preprocessing: conditional macro text substitution Lexical analysis: convert keywords, identifiers, constants into
- 29. slide Language Interpretation Read-eval-print loop Read in an expression, translate into internal form Evaluate internal form
- 30. slide Virtual machine runtime Bytecode Compilation Combine compilation with interpretation Idea: remove inefficiencies of read-eval-print loop
- 32. Скачать презентацию