CS 350 Fall 2022
Table of Contents
Welcome to the CS350 course offering in Principles of Programming Languages, 2022-23 Semester I.
1. Syllabus
We will cover the following two languages in a fair amount of detail, with emphasis on programming in these languages, and their semantics.
- Haskell (an example of a functional language)
- Smalltalk (an example of an Object-oriented language)
We will also discuss the fundamentals of functional languages using the following
- untyped lambda calculus, with special emphasis on combinators.
- simply typed lambda calculus, with emphasis on type inference
In the past, we followed a text by van Roy and Haridi. Even though the text is good, the language Oz does not seem to be under active development. Some topics in this text will be adapted to the languages at hand. In particular, we will explain the Unification Algorithm using, perhaps a fictitious expression language to be described in class.
2. Notes
Ruby notes (These are draft notes from 2015.) Reflection and Metaprogramming
3. Code samples
3.1. Haskell
- ./haskell_code/lec_01_01.hs (neg, id, or, len: introduction to type inference and parametric polymorphism)
- ./haskell_code/lec_01_02.lhs (Literate Haskell example)
- ./haskell_code/lec_01_03.hs (Higher order programming example)
- ./haskell_code/lec_02_01.hs (Higher order programming: map, fold, filter etc.)
- ./haskell_code/lec_02_02.hs (factorial)
- ./haskell_code/lec_03_01.hs (…)
- ./haskell_code/lec_03_02.hs (…)
- ./haskell_code/lec_04_01.hs (Tail recursion : Fibonacci and Fibonacci)
- ./haskell_code/lec_05_01.hs (Streams: not yet covered)
- ./haskell_code/lec_05_02.lhs (The Sieve of Eratosthenes)
- ./haskell_code/lec_06_01.lhs (user-defined data type: Shape)
- ./haskell_code/lec_06_02.lhs (user-defined data type: nested lists, binary trees)
- ./haskell_code/lec_07_01.lhs
- ./haskell_code/lec_07_02.lhs
- ./haskell_code/lec_07_03.lhs
- ./haskell_code/lec_10_01.lhs (IO: putStrLn)
- ./haskell_code/lec_10_02.lhs (IO: terminal input)
- ./haskell_code/lec_10_03.lhs (do notation: let for variable introduction)
- ./haskell_code/lec_10_04.lhs (do notation: error in syntax)
- ./haskell_code/lec_10_05.lhs (IO with do notation: reverse words)
- ./haskell_code/lec_11_01.lhs (Maybe monad)
- ./haskell_code/lec_11_02.lhs (List monad)
- ./haskell_code/lec_12_01.lhs
- ./haskell_code/lec_12_02.lhs
- ./haskell_code/lec_12_04.lhs
3.2. Ruby
- ./ruby_code/lec_16_01.rb (Hello, World)
- ./ruby_code/lec_16_02.rb (Variables, assignment, dynamic typing)
- ./ruby_code/lec_16_03.rb (input and output)
- ./ruby_code/lec_16_04.rb (global variables)
- ./ruby_code/lec_16_05.rb (arrays)
- ./ruby_code/lec_16_06.rb (blocks - i.e. closures)
- ./ruby_code/lec_16_07.rb (copying a file to another)
- ./ruby_code/lec_16_08.rb (common control structures)
- ./ruby_code/lec_16_09.rb (methods, arguments: default, optional, block)
- ./ruby_code/lec_17_01.rb (iterators)
- ./ruby_code/lec_18_01.rb (hashes in ruby) (similar to dictionaries in Python, and associative arrays in other languages)
- ./ruby_code/lec_19_01.rb (a basic class in Ruby)
- ./ruby_code/lec_19_02.rb (subclasses)
- ./ruby_code/lec_19_03.rb (
=
) - ./ruby_code/lec_20_01.rb (method overriding, singleton methods)
- ./ruby_code/lec_20_02.rb (self)
- ./ruby_code/lec_21_01.rb (changing self)
- ./ruby_code/lec_21_02.rb (open classes)
- ./ruby_code/lec_22_01.rb (using reflection to add access methods dynamically)
- ./ruby_code/html.rb (the html DSL framework)
- ./ruby_code/html_sample.rb (sample file in the DSL)
4. Work
This course will be programming intensive.
We will have the following
- Programming homeworks [4x5 percent each]
- One Programming Project to implement a language [10 percent]
- Best 2 of 3 quizzes [2x10 percent]
- Midsem [20 percent]
- Endsem [30 percent]
5. Homeworks
- Homework 1, due September 4, 2022
- Homework 2, due October 25, 2022
- Project, due November 15, 2022. (in teams of 2 or 3)
- Homework 3, due November 15, 2022. Associated files:
- ./ruby_code/md.rb for the simple markdown parser
- Sample input to the modified markdown parser: ./ruby_code/sample.md
- ./ruby_code/game.zip
6. Textbooks
Course notes will be posted online.
Longer explanation
The course does not have a textbook per se, since the textbook we used to use, van Roy and Haridi, is based on a language that does not seem to be actively supported. However, we will try to follow material from the following books.
- Concepts, techniques and models of programming, van Roy and Haridi, MIT Press.
- The Structure and Interpretation of Computer Programs, Abelson and Sussman, MIT (available online at https://mitpress.mit.edu/sites/default/files/sicp/index.html )
7. Instructor
Satyadev Nandakumar satyadev@cse.iitk.ac.in