








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The skills and concepts covered in the cs3723 course on concepts in programming languages. Topics include language syntax, lambda calculus, functional programming, type inference, tail recursion, object-oriented programming, and more. Students will learn how to define languages using bnf, understand lambda calculus and functional programming, translate between languages, and explore advanced topics such as memory management and implementing functions.
Typology: Study notes
1 / 14
This page cannot be seen from the preview
Don't miss anything!









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 …
Key: understand the algorithm (get pass the syntax barrier) Function definitions can be nested inside one another, but a function block is not entered untilled the function is invoked by a caller Exercise: list the order of events for the following code; then draw the runtime stack snapshot. 1: let 2: fun mk_x(x) = 3: let fun add1(y) = x + y 4: in 5: let val x = 7 in add1(5) end 6: end 7: fun apply(f,x) = f(x) 8: in 9: apply(mk_x,10)- 10:end;
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
Types are classification of values Different types of values have different layout/interpretation
Name vs. structure type equivalence
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
Parametric, ad-hoc and subtype polymorphism
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
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
Have constructors and can be used to build objects Grouping of relevant data and functions Access control: private, protected, public, friend, package
Separate interface from implementation details
Values of subtypes can be used to substitute base type values
Function pointers stored inside class objects Virtual function are looked up at runtime
Derived classes can redefine virtual functions of base classes
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 methodsfunction pointers as values Java/C++ subtyping union types and pattern matching
Layout of class objects and Java interfaces Managing class member functions Design philosophies of the two languages