UMBC CMSC 331 Spring 2014
Principles of Programming Languages
Home · About· Schedule · HW · Exams · Notes · Code · Resources ·

Schedule of topics and assignments is subject to change

#
day
date
topic
text
notes
to do, comments
1
Tue
1/28
Introduction
ch 1, 2

read: The 100 Year Language, compilers, IDE, virtual machine, bytecode, PL Timeline
see Also: Teach yourself..., Worse is Better,
New languages come out all the time. See a reference to Harlan, and a reference to Go

2
Thu
1/30
Some history
ch 2

There is some important terminology in Chapter 1
Figure 2.1 gives the impression that PL design is evolving over time, and that's true!
Some languages are the work of individuals, others are the work of committees. Algol and Smalltalk are examples.
Popularity of programming languages is illustrated by http://www.tiobe.com/tiobe_index

3
Tue
2/4
Syntax
ch 3

read: sammet, Steele essay, WP article, programming paradigms
view: Steele interview
We're going to start talking about regular expressions, using Perl as an example. But we might not cover Perl in detail until later.

4
Thu
2/6
Syntax
ch 3

Need a C cheat sheet, to accompany the C++ cheat sheet.
Let's introduce C and C++, looking at both through the lens of a programming languages class
Homework 1: Problems 3,4, 6, and 7 from problem set at the end of Chapter 3. (Page 163 of the tenth edition.) Hardcopy OR electronic due in class on Tuesday February 18.

5
Tue
2/11
Syntax
ch 3

Finish the syntax portion of Chapter 3
read:
operator precedence, BNF, BNF examples, EBNF, ebnf.pdf, CFG, parsing, Chomsky hierarchy
seeAlso: BNF and EBNF: What are they and how do they work

6
Thu
2/13
Semantics
ch 4

SNOW DAY!
So we push the rest of Chapter 3 to next week

read:
semantics, attribute grammar, operational semantics, denotational semantics, axiomatic semantics, Verification, proofs.pdf,

As an example of a scripting language, from this courses's perspective, consider Javascript.
The Javascript Cheat Sheet. Here is A re-introduction to Javascript

Knuth's paper on attribute grammars (pdf)
We skip the material on denottional semantics
read: compact guide to lex and yacc

7
Tue
2/18
Lexical and Syntactic Analysis
ch 4


Catch up from snow

8
Thu
2/20
Lexical and Syntactic Analysis
ch 4
Homework 2: Assigned exercises from the Problem Set at the end of Chapter 3, on pages 164 and later. Exercises 12, 13, 23 and 25. Electronic submission by Thursday 2/27.

Still catching up!

read: Regular expressions, regular grammars
9
Tue
2/25
Parsing
ch 4

Begin discussion of regular expressions and parsing tools.

An in-class Javascript exercise: Using the Javascript Cheat Sheet as a starting point, create a web page that allows a user to do arithmetic using Javscript's math operations. Create a second web page that tests to see if an input string is at least ten characters long, and has a mixture of digits, lower case letters and upper case letters, making the input string a decent password.

Information about how to use Lex and YACC from IBM
That calculator example for Lex and YACC can be found there.

10
Thu
2/27
Parsing
ch 4

read: parsing, top-down, recursive descent, bottom-up, ll(k), lr(k)

We're skipping some of the compiler material in Chapter 4,

11
Tue
3/4
Some C++
ch 4

Any student note-taker volunteers? Pay is $7.25 an hour. Sign up at Student Support Services, MP 213 M-F from 9am-2pm.

Continue with Chapter 4. We will also begin C and C++.
Wikibooks features C Programming. (pdf) as of today.
The C++ handout is called cppcs.cpp

12
Thu
3/6
More C++

do: download PLT scheme, and/or try mzscheme on gl

seeAlso: Teach yourself scheme

13
Tue
3/11
More C++

Finish Chapter 4

For more on C++, see Stroustrup's recent overview (pdf)

14
Thu
3/13
More C++
But UMBC is closed with water problems!


There is an updated C++ cheat sheet here

C++ programming exercise:
Due Tuesday, April 1.
Extra credit if submitted by Friday, March 28.

Create a C++ program that extends the rational class from the C++ cheat sheet as follows:

1. Add a square root function to the rational class. Have your program print the square root of 1/2, and the square root of 1/100. Hint: you won't get an exact answer for the square root of 1/2, but you can get an approximate value as follows: Let rational(n,d) be any rational object. To calculate the square root, use the the integer part of sqrt(100*n) as the numerator, and likewise for the denominator d.
2. Add a harmonic series sum function to the program. The sum of a harmonic series is the sum of the rationals 1/1 + 1/2 + 1/3 + 1/4 + ... + 1/n for some integer value of n. Have your program print the sum of the harmonic series for n = 12. You can use a for loop, a while loop, or recursion, your choice.
3. You may use the cheat sheet code, but remove print statements from main that aren't related to parts 1 and 2.

For grading: use the UNIX script command to capture the program's output. Email your C++ code and the resulting typescript file to BOTH nicholas@umbc.edu AND mat7@umbc.edu. Emailing to me only may delay grading of your assignment.

    3/16-3/23 Spring Break      
15
Tue
3/25
Lisp
ch 15

read: Guide:3, Guide:4, scope, closure
read: on using DrScheme , Guide:1, Guide:2, using scheme on gl

The Lisp Cheat Sheet is available here, and you can get it from my directory on GL using the command
cp /afs/umbc.edu/users/n/i/nicholas/pub/331/LispCheatSheet.cl .

The Lisp Cheat Sheet handout (pdf)
Slides for Lisp and Scheme are available.
run: cfg1.ss, cfg2.ss, cfg.ss, fib.ss

16
Thu
3/27
more Lisp


17
Tue
4/1
Review for Exam
ch 15
Review for midterm next week. There are many old midterm and final exams on the web site.

Topics for the exam may include these.

The Lisp Cheat Sheet is now updated across this web site and my /pub directory on GL.
C++ project due tonight at midnight

18
Thu
4/3
yet more Lisp
ch 15
 

view: DrScheme v4 tour
read: functional programming, lambda calculus,


19
Tue
4/8
mid term

read: tail recursion, lazy evaluation, delay,variable
study: everything

20
Thu
4/10
Work on Lisp in class

Lisp programming exercises, from p. 724 of textbook:
Write Lisp functions to (1) compute the volume of a sphere, given its radius (2) compute the real roots of a quadratic equation (6) take a simple list of numbers and return a list consisting of the smallest and largest numbers in the input list (19) implement the quicksort algorithm, which takes a simple list of integers and sorts them.
And, from the midterm: Write a Lisp function that takes three arguments: a list of integers called aList, an integer called min, and an integer called max.  The function returns the number of elements in aList that fall in the range min <= x <=max, where x is an element of aList.  If aList is empty, the function should return 0.  You can define additional “helper” functions if you like. 
Due Tuesday April 22.


21
Tue
4/15
More Lisp in class

read: Currying,

22
Thu
4/17
Wrap up Lisp

 

 


23
Tue
4/22
Start Haskell

 

Went over the midterm exam.
The Haskell Cheat Sheet is available as source (.hs) and the handout (.pdf)


24
Thu
4/24
More Haskell

Graham Hutton's Haskell slides are here, and also
http://www.cs.nott.ac.uk/~gmh/book.html
There is a main Haskell web site.

25
Tue
4/29
Yet more Haskell


Assign the Haskell Project, due May 8 at midnight.

In class I mentioned the web site https://www.fpcomplete.com/school

26
Thu
5/1
Haskell in class



27
Tue
5/6
Haskell in class

 

Haskell Fast and Hard is an excellent introduction to Haskell for people with solid CS backgrounds.

For EXTRA CREDIT write a Haskell function that takes a text file as input, divides it into words, and counts the number of words of three letters or less. Then take the words and stre them in a hash table, a data structure thatis built into Haskell.

For EXTRA CREDIT you can write a Haskell function that demonstrates the use of arrays in manipulating strings. For example, adapt the vowel counting functions to work with a string that has been converted into a Haskell array. See Data.Array.IO. You can also try Data.Vector.

28
Thu
5/8
Haskell in class

Finish Haskell today.

You may want to look at my Python 3 cheat sheet! (cs.py). Here's the typescript file from its execution. Comments are welcome. Check out the Python web site.

29
Tue
5/13
Review

 

Here's the final exam (pdf) from last semester.

to review for the final, I recommend:

  • that you focus most of your time on material we covered since the midterm.
  • make sure you understand what's on the Haskell and Lisp cheat sheets, and bring those to the exam. I will NOT have extra copies.
  • ask yourself how you'd do the exercises from the end of the object-oriented programming and functional programming chapters in the textbook. That's where I might go to get ideas for exam questions.
  • there'll be some T/F questions, covering any topic from the course. I won't ask much in the way of history questions.
--
Tue
5/20
final exam 3:30-5:30pm
study: old exams