CS3723: Concepts in Programming Languages - Course Review, Study notes of Programming Languages

An overview of the skills and knowledge gained in a programming languages course (cs3723). Topics covered include language syntax, lambda calculus, functional programming, type inference, tail recursion, object-oriented programming, language semantics, types, scopes, and runtime control. Advanced topics include implementing functions, exceptions, and abstractions.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-tf3-2
koofers-user-tf3-2 🇺🇸

5

(1)

10 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
cs3723 1
Review
Concepts in Programming
Languages
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CS3723: Concepts in Programming Languages - Course Review and more Study notes Programming Languages in PDF only on Docsity!

Review

Concepts in Programming

Languages

What we have learned

 Skills

 Language syntax (context-free grammar, parse tree, and AST)  Lambda calculus (apply beta reduction)  Functional programming (recursion in Scheme and ML)  Type inference (from Scheme to ML or C)  Tail recursion, loops, and continuation passing (methods of programming)  Object-oriented programming (from ML datatype/abstype to C++ classes)

 Knowledge (concepts)

 Language semantics (expressing power, interpretation vs. compilation, higher-order functions, functions as first-class objects)  Types, type checking and type inference; Polymorphism  Memory management (blocks, functions, classes and inheritance)  Continuation and exceptions  Abstractions, object-oriented abstractions,  C++ and Java language design and implementations

 Advanced topics

 What if we modify a language by adding …

Concepts:

Languages and Functions

 Why high-level programming languages?

 Productivity, portability, maintenability, machine efficiency

 What can programming languages express?

 Data and algorithms

 Partial recursive functions

 Programming paradigms

 Can you define what they are and give examples?

 Functional, imperative, object-oriented

 What is a high-order function? What does “functions are first-

class objects” mean?

 In what ways can prog. languages be implemented? Give examples? What is the trade-off? What are the implementation phases

 Compilation vs. interpretation

 Lexical analysis, Syntax analysis, semantic analysis,

interpretation/code generation+optimziation

Concepts --- Types

 What is a type? What is it used for?  Types are classification of values  Different types of values have different layout/interpretation  Type declaration and equivalence  Name vs. structure type equivalence  What is a type system  How to determine types of variables and expressions?

 Compile-time vs. runtime type checking

 Type checking vs. type inference

 Compile-time vs. runtime type checking

 Type safety of languages  Polymorphism  Parametric, ad-hoc and subtype polymorphism

Concepts-- Implementing Functions  How many ways can parameter values be passed?

 Pass by value vs. pass by reference

 What is a function closure? What is it used for?

 The value of a function <code, env>

 Used to setup environment for function calls

 Why is implementing higher-order functions hard?

 When a function returns other functions, the activation

records needs to be saved

 Activation record in the heap  OO languages

 What is tail recursion? Why is it equivalent to loops?

 Tail recursion: do not need to return

 What is a continuation? What is continuation passing

 Continuation: the rest of computation after function exit

Concepts: Exceptions

 Why are exceptions considered dynamic jumps?

 Static jumps: goto, loop, conditionals, …

 Exception:

 Jump out of one or many levels of nested blocks  Until reaching some program point to continue  Pass information to the continuation point  What is required from a language to support expections?

 Type (exception) declaration

 Raise an exception

 Handle an exception

 Are exceptions part of the type system?

 Raising of exceptions not part of type system

 Handling of exceptions need to agree with type system

Object-oriented Abstractions

 OO abstractions are types

 Have constructors and can be used to build objects

 Grouping of relevant data and functions

 Access control: private, protected, public, friend, package

 Encapsulation

 Separate interface from implementation details

 Subtype polymorphism

 Values of subtypes can be used to substitute base type values

 Dynamically-bound functions

 Function pointers stored inside class objects

 Virtual function are looked up at runtime

 Implementation inheritance

 Derived classes can redefine virtual functions of base classes

Object-oriented languages

 C++/Java classes vs. ML datatype + scoping (nested functions)  ML can simulate most features of C++/Java except

 Inheritance and extensibility

 Java/C++ encapsulation  ML function closure  Java/C++ namespaces ML structures/signatures  Java/C++ virtual methodsfunction pointers as values  Java/C++ subtyping  union types and pattern matching  Implementation of classes C++ vs. Java  Layout of class objects and Java interfaces  Managing class member functions  Design philosophies of the two languages