Attempts to A means of formal and exact communication define a - - PowerPoint PPT Presentation

attempts to
SMART_READER_LITE
LIVE PREVIEW

Attempts to A means of formal and exact communication define a - - PowerPoint PPT Presentation

A tool for humans to tell the computer what to do Attempts to A means of formal and exact communication define a between humans Programming A way of describing an abstract machine Language A way of describing computation that


slide-1
SLIDE 1

18

Attempts to define a Programming Language

  • A tool for humans to tell the computer what

to do

  • A means of formal and exact communication

between humans

  • A way of describing an abstract machine
  • A way of describing computation that is

readable by both man and machine

slide-2
SLIDE 2

19

Why programming languages?

  • Reasons to study programming languages

– Learning new programming languages – Borrowing ideas from other languages – Ability to express ideas – Choice of programming language – Understanding the implementation behind languages – Designing your own "programming language"

slide-3
SLIDE 3

20

3 topics of the course

  • "Theory of programming languages"

– Syntax, value/reference semantics, type

systems, language design criteria

  • Programming issues

– Paradigms, typing, variable lifetimes,

parameter passing, type inference...

  • "Looking under the hood"

– How compilers/interpreters work (on

general level)

– Data representations, memory allocation,

activation records, machine language, virtual machines, binary compatibility...

slide-4
SLIDE 4

21

MOTTO

  • "Good engineering involves compromise at

every turn. A good, working, finished product is never pure by the standards of any one idiom or methodology. The art of good engineering is not the art of discovering and applying the one right idiom over all others. The art of good engineering is to know what your options are, and then to choose your trade-offs wisely rather than letting others choose them for you."

  • http://www.artima.com/cppsource/

type_erasure.html

slide-5
SLIDE 5

22

Design of languages

Design issues: 1. simplicity, regularity, uniformity 2.

  • rthogonality

3. expressiveness 4. support for software engineering practices 5. efficiency 6. error detection and debugging, safety 7. correctness 8. standardization 9. recently: ecosystem: libraries, editors, debuggers, ...

slide-6
SLIDE 6

23

History of languages

  • No language exists in vacuum, languages:
  • are often based on other languages
  • steal features from other languages
  • try to steal programmers from other

languages

  • try to fix stupid features in other languages
slide-7
SLIDE 7

24

Evolution

  • Languages often evolve
  • Need for new features, fixing old errors
  • Downwards compatibility is a problem!
  • Compromises: added complexity, lack of
  • rthogonality...
  • deprecated/compatability features, e.g., C+

+ auto_ptr, register-keyword

  • New features get adopted, e.g. type

inference (compiler deduces types of variables etc. instead of having to write types explicitly) is spreading to mainstream languages

slide-8
SLIDE 8

25

Abstract machines

  • An (imaginary) machine that can execute

programs in a certain language

  • A way of specifying the semantics (meaning) of

the language

  • Hardware machine + compiler
  • Intermediate (virtual) machine + compiler
  • Pure interpreter
  • "The semantic descriptions in this International

Standard define a parameterized nondeterministic abstract machine. ... conforming implementations are required to emulate (only) the observable behavior of the abstract machine..." (C++14 standard draft, 1.9/1)

slide-9
SLIDE 9

26

Compromises in languages

  • Expressiveness – Efficiency
  • Intuitiviness – Implementability
  • Intuitiviness – Unambiguousness
  • Unambiguousness – Optimisability
  • Flexibility – Checkability
  • Portability – Efficiency
  • Generality – Ease of expression
slide-10
SLIDE 10

27

Compiled vs. interpreted

  • Interpreted

– Dynamic typing – Portability – Run-time error checking – Flexibility

  • Compiled

– Static typing – Machine dependent – Error checking by compiler – Efficiency

These are the two extremes. In many languages we are often somewhere between!