Principles of Programming Languages Review - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Principles of Programming Languages Review

Description:

They are a 'hack': cheating on the formal grammar and automata theory. ... focuses on the process/tools/management of developing large programs by teams of ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 17
Provided by: evangelo
Category:

less

Transcript and Presenter's Notes

Title: Principles of Programming Languages Review


1
Principles of Programming Languages Review
  • April 1, 2001

2
What did we learn?
  • Part 1 principles
  • Formal languages and automata.
  • Scanning and parsing
  • Attribute grammars
  • Part 2 another point in the space of prog.langs.
  • Scheme and Common Lisp.
  • Part 3 fundamental aspects of prog. langs.
  • Variables, scope and bindings
  • Expressions, statements and control
  • Data types, garbage collection
  • Subroutines
  • Building a runnable program
  • Data abstraction and object-orientation

3
Formal languages and automata
  • Why did we need this material in this course?
  • We only scimmed the surface.
  • There are more powerful automata (Turing
    machines).
  • There is an elegant theory that describes the
    difficulty of problems in terms of whether they
    can be solved
  • at all by an algorithm (decidable)
  • in a meaningful amount of time and/or space
    (NP-complete).
  • CSCI 4112 (Theory of computation) covers the
    theory

4
Scanning and Parsing
  • The first stages of analyzing the program to be
    compiled.
  • Based on formal languages and automata with a lot
    of pragmatic extensions.
  • Generating scanners and parsers is usually done
    automatically from a formal specification (reg.
    expr. or CFG, see lex/yacc)

5
Attribute grammars
  • Extend the power of context free grammars
  • To capture semantics
  • To generate lower-level code
  • They are a hack cheating on the formal grammar
    and automata theory.
  • But they are useful and necessary.

6
Scheme
  • Why introduce Scheme?
  • A different model of programming language
  • Typeless variables
  • Run-time type checking
  • higher-order procedures
  • closures as first class objects
  • continuations

7
Fundamental Tradeoffs
  • C/C and Scheme/Common Lisp at two opposite ends
    of the spectrum,
  • All other languages somewhere in between.
  • Tradeoffs in terms of
  • efficiency
  • safety
  • expressive power.

8
Fundamental aspects of programming languages
  • With the previous material as a basis, we moved
    on to examine several fundamental aspects of
    programming languages.
  • variables, storage, scope and bindings
  • expressions, statements and control
  • data types, safe pointers, garbage collection
  • subprograms
  • constructing runnable programs.
  • data abstraction and object-oriented prog.

9
Approach
  • The approach was to
  • Briefly sample the design choices of various
    programming languages.
  • Consider implementation issues at a high level.
  • Discuss the fundamental tradeoffs of efficiency,
    safety and expressive power.

10
How to introduce programming
  • Various schools of thought
  • Start with an industrial strength prog.lang.
    (e.g. C/C)
  • Start with a conceptually clean prog.lang. (e.g.
    Scheme)
  • Go from low-level (built-in data and control) to
    higher level aspects (like data abstraction) --
    objects last
  • Go from higher level (data abstraction) and embed
    low level firmly in it -- objects first

11
How to learn languages beyond the first one
  • By identifying similarities and differences to
    the language(s) you already know.
  • This is independent of how you were taught your
    first language.

12
What did this course try to accomplish?
  • To give you a birds eye view of programming
    languages, so as to speed up the process of
    learning new languages.
  • Side effect to focus on what is important and
    what is secondary in a language.
  • To recognize that apparent quirks in a language
    may be due to design choices in the fundamental
    tradeoffs.

13
What this course was not.
  • A programming course
  • A compiler design course
  • A software engineering course

14
How else could this course have been taught?
  • As a more shallow encyclopedic review of
    programming language features
  • As a compiler design course
  • Using a fully implemented interpreter as the
    basis for discussing prog. language features (see
    book by Friedman, Wand, Haynes)

15
How this course relates to other courses
  • Functional and logic programming focuses on the
    functional programming style, lambda calculus,
    and logic programming. More emphasis on these
    unorthodox programming paradigms.
  • Object-oriented programming focuses on
    object-oriented programming, more emphasis on
    software engineering issues.
  • Software engineering focuses on the
    process/tools/management of developing large
    programs by teams of programmers.

16
Conclusion
  • I hope that you learned something useful in this
    course, and that you enjoyed the process (to the
    extent possible).
Write a Comment
User Comments (0)
About PowerShow.com