UMBC CMSC 331 Fall 2016
Principles of Programming Languages
Home · About· Schedule· Resources ·

Schedule of topics and assignments are subject to minor changes

(last updated December 19, 2016)

#
day
date
topic
reading(s)
to do, comments
1
Thu
9/1/2016
Introduction
course web page

Went over course web page. Discuss some terminology such as
compilers, IDE, virtual machine, bytecode, PL Timeline

New languages come out all the time, including Go, Swift, and others.

For next time:
Consider building a VM for 331. Read Chapter 1 in textbook

2
Tue
9/6/16
Some history
Chapters 1 and 2

More course introduction (pdf)
There is some important terminology in Chapter 1

New to virtual machines? I recommend Virtual Box. Download the software before class, please. You can get lots of different Linux distrros, but I use desktop Ubuntu. In class I demonstrated installation of an Ubuntu virtual machine.

For next time:
Read Chapter 2, sections 2.4, 2.5, 2.16-2.18

3
Thu
9/8/16
Syntax
Chapter 3

Popularity of programming languages is illustrated by http://www.tiobe.com/tiobe_index

History of Programming Languages is the subject of Chapter 2
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.

The UMBC Cyber Defense Club, also known as the Cyberdawgs, has lots of activities.

The original book on the C language was called "The C Programming Language". The second edition is still available.

For next time:
Chapter 3 of textbook, sections 3.1-3.3

4
Tue
9/13/16
Syntax
 

Dr. Nicholas will be teaching over Skype today, from Vienna, Austria.

The syntax of a PL refers to the rules that determine what is and is not a valid program in that language. Begin slides from Chapter 3 (pdf)

Slides from Chapter 3 (ppt)

The Cyberdawgs will be able to help with Linux installs on Virtualbox for those who need it. Wednesday, 9/14/2016, ITE 366, 1-2pm.

Homework 1: In the 11th edition, from the Problem Set that begins on page 158:
Problem 7a-d, , 12a-e, and 13.
In the tenth edition, the exercies begin on page 164, and have the same numbers: Problem 7a-d, 12a-e, and 13.
Due in class on Tuesday 9/20/2016. Submit this homework in hard copy.

5
Thu
9/15/16
Syntax

More teaching from Austria

Want to earn some money helping a fellow student? I'm looking for somebody willing to take good notes, and share them with a classmate. Some training is provided. Preparing the notes is a good way to get paid for studying! Send me an email.

Continue Chapter 3, covering attribute grammars

For next time:
read:
operator precedence, BNF, BNF examples, EBNF, ebnf.pdf, CFG, parsing, Chomsky hierarchy
see Also: BNF and EBNF: What are they and how do they work

6
Tue
9/20/16
Semantics

Finish Chapter 3 discussion of synatx and attribute grammars

The Wikipedia article on AGs is helpful, if for no other reason than the external links, which include:
Knuth's paper on attribute grammars (pdf) perhaps still the best explanation of this concept.
From the Monad.Reader Why Attribute Grammars Matter

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
There is a lot of good information, it seems, under w3schools.com.

optional readings Steele essay
optional viewing: Steele interview

7
Thu
9/22/16
Lexical and Syntactic Analysis

Still looking for a note taker!

Comments from last time about phases of compiliation comes from Chapter 1, which we can review if desired.

Begin slides (pdf, ppt) for Chapter 4.

Check out the Python web site. Discuss some intermediate or advanced features of Python. You may want to look at my Python 3 cheat sheet! (cs.py), which I very much need to update.

Or we might want to look at some of my Python 3 code, which I have spent about a year writing (vx6.py). For examples of right and wrong ways to code in Python.

For next time:
read: compact guide to lex and yacc

8
Tue
9/27/16
Lexical and Syntactic Analysis
Chapter 4

Announcements:
Still looking for a note taker!
Normal office hours on Wednesday (2-3:30pm) are shifted to Thursday 2:30-4pm this week. Return homework. Questions welcome on Thursday.

Continue Chapter 3, covering basics of axiomatic semantics. Continue slides (pdf, ppt) for Chapter 4.

If time permits, which it did not...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. You will want to consider Javascript's eval function. 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.

Read: Regular expressions, regular grammars

9
Thu
9/29/16
Parsing

Continue discussion of regular expressions and parsing tools.

Information about how to use Lex and YACC is available at this compact guide to lex and yacc

10
Tue
10/4/2016
Parsing

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

Finish the material on recursive descent parsing in Chapter 4. (We're skipping the material on LL parsing and bottom-up parsing.) I will go through the example Lex/YACC program given in /afs/umbc.edu/users/n/i/nicholas/pub/331/lexYacc/calc. You can all make use of this from GL.

Lex and YACC have been ported to languages apart from the traditional C.
Lex and YACC for Python.

11
Thu
10/6/2016
Some Java
 

A programming project is coming up. We'll design a simple programming language, and create lex and YACC files for it. The language will draw features from languages such as C and Java.

A parser for HTML is more complicated than I prefer, and of limited teaching value. But take a look at this YACC file for XML and this Lex file for XML.

We designed the Gimli language for parser project. "Just keep breathing, that's the key."

Homework: For Tuesday October 11, create a short Gimli program, and write a parse tree for it, using the grammar for the gimli language. If you need to modify the grammar a little in order to parse your example program, explain what changes were made. Hand-written is okay, as long as the work is NEAT and staples used as appropriate!

12
Tue
10/11/2016
More Java

Programming Project: Due by 11:59pm, next Tuesday, October 25. Extra credit if turned in by midnight Thursday October 20.
Consider the files skeleton.lex and skeleton.y. Add rules to them as needed to implement a syntax checker for the Gimli language designed last week. Your grammar may vary slightly from what we talked about last time. You should place comments in your code to explain this. But the grammar you use should not be ambiguous (which happens when YACC reports "reduce/reduce" conflicts.) There is a makefile available too. Submit your Lex and YACC files as attachments to an email. Also attach a typescript file that demonstrates the features of the program. Send that email to the TA, Sriraj, and cc me.

Introduce Java. Slides on Java, part 1, part 2, part 3, and part 4

A bunch of Java example programs, from Java in a Nutshell.

Extra Credit: Dr. Claudia Pearce speaks on How I Became a Computer Scientist this afternoon at 4:30. Attendance earns some modest extra credit.

13
Thu
10/13/2016
More Java

I will demonstrate the script command on GL, and maybe some Emacs features that will make it faster.

The revised Java Cheat Sheet is now available. I'll also demonstrate NetBeans, which is one of several free Java IDEs.

Finish Chapter 4, and more on Java as needed.

14
Tue
10/18/2016
More Java

Slides on the Java API (ppt) (pdf)

Cyberdawgs event Wednesday (tomorrow 10/19/16) 7-9pm "Smart Phone Hacking", ITE 104.

I am considering a short Java project . I've removed some information here to avoid confusion with the real assignement, described below.

15
Thu
10/20/2016
Finish Java

More Java, and more on the Gimli project. Looked at several of the Java example programs, from Java in a Nutshell.

16
Tue
10/25/2016
more Lisp
Chapter 15

Charles will be teaching from far-off Indianapolis.

Java programming exercise:
This is a simple and limited web crawler. Write a Java program that takes one command line argument, namely a string representing the URL of some random web page. Your program should go out to that web site, read the HTML file there if it can, and record the following: the length (in bytes) of the HTML file; and, if an anchor tag is present, which looks like

<A HREF="http://some.web.site/possiblestuff">

add that web site to a list of sites to be visited. Have your program stop when EITHER a total of one million bytes have been read, OR the list of web sites to be visited gets to 15 OR the list of web sites to be visited is empty. When each file is processed, remove it from the "to be visited" list. Anticipate and catch the various error conditions that may arise.

Due date: 11:59PM, Tuesday, November 15. Send your .java file, typescript, and Makefile to Siraj Memon and me as usual.  Include the phrase Java Project in the subject line.

Slides for LISP and scheme. We'll be covering this material this week and next!
scheme1 (pdf). The Common Lisp Cheat Sheet is available, and you can get it from my public directory on GL using the command (note the space followed by period)

cp ~nicholas/../pub/331/scheme/CommonLispCheatSheet.cl .

The Lisp Cheat Sheet handout (pdf) is still available, but it's older and a little different.

17
Thu
10/27/2016
More LISP and scheme
Chapter 15.2-15.6

You can try running these examples on GL, using the clisp or mzscheme commands.
run:cfg1.ss, cfg2.ss, fib.ss

scheme2 (pdf)

Using clisp on GL. If a copy of the cheat sheet is in your durectory, use these commands:

clisp
(load "CommonLispCheatSheet:") ; note no .cl suffix
(allDemos)
(exit)

Use :q to get out of a "Break loop"

18
Tue
11/1/2016
yet more Lisp
Chapter 15.2-15.6

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

There is a useful tutorial on Lisp here. The full text of the "mother of all Common Lisp books", Steele's Common Lisp, is available here. If I had to learn a lot of Lisp in a hurry, this is where I'd go.

There are many old midterm and final exams available. We will spend some time reviewing for the exam.

Topics for the exam may include these.

19
Thu
11/3/2016
mid term

 

20
Tue
11/8/2016
More Lisp

Don't forget to VOTE!

Functional programming in LISP and scheme (pdf)

Beginning next week, we'll be using some class time for these Lisp programming exercises, from p. 724 of textbook (tenth ed), and a nearby page in the eleventh edition. Write Lisp functions to (1) compute the volume of a sphere, given its radius (2) compute the real AND COMPLEX roots of a quadratic equation (3) take a simple list of numbers and return a list consisting of the smallest and largest numbers in the input list (4) implement the quicksort algorithm, which takes a simple list of integers and sorts them.
And, : 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.

Extra credit: Demonstrate the array functions in Common Lisp by taking two matrices of your choice, m x n and n by p for values of m, n, and p greater than or equal to one, and perform matrix multiplication.. No fair using "canned" matrix multiply functions that may come with Common Lisp!

Extra credit: Demonstrate the use of random numbers to generate an approximate value of pi. The function should take one parameter, namely the number of pairs of random numbers to use in the calculation.

The rubric used for the Lisp exercises is now available.

Due date: December 1, 2016

21
Thu
11/10/2016
More Lisp


Go over the midterm exam. Finish slides on functional programming in Lisp.

22
Tue
11/15/2016
Wrap up Lisp

Work on Lisp exercises in class.

An updated Common Lisp Cheat Sheet is available, and you can always get it from my directory on GL using the command
cp ~nicholas/../pub/331/scheme/CommonLispCheatSheet.cl .

23
Thu
11/17/2016
More Lisp

A reference for Common Lisp can be found at https://common-lisp.net

24
Tue
11/22/2016
Start Haskell
Ch 15.8 and 15.10


There is a main Haskell web site.

The Haskell Cheat Sheet is available from my directory on GL, as follows (note the space followed by period)

cp ~nicholas/../pub/331/haskell/haskellCS3.hs .

25
Thu
11/24/2016
Thanksgiving Day


26
Tue
11/29/2016
Haskell in class

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

An updated Haskell cheat sheet, the file haskellCS3.hs, is available in my pub directory on GL. You should be able to get the cheat sheet to run under Haskell yourself, as documented. Let me know if you cannot do so.

27
Thu
12/1/2016
More Haskell

In class I should mention the web site for the Functional Programming School

Assign the Haskell Project

27
Tue
12/6/2016
Haskell in class

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

I have updated the Haskell Cheat Sheet, with another example function, and information about running Haskell using GHCI.

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 store them in a hash table, a data structure that is built into Haskell.

For EXTRA CREDIT write a Haskell function that creates a list of random integers, and then sorts that list using mergesort and quicksort. Both are O(n log n), but which is faster in practice?

Office Hours tomorrow, Wednesday, are 1-2pm (earlier than usual)

28
Thu
12/8/2016
Haskell in class

A free day to work on Haskell. Nicholas is on travel today.

Please remember to fill out the course evaluations! It would be gratifying to get a high response rate from this class :-)

Extra credit for Haskell projects turned in before midnight tonight.

29
Tue
12/13/2016
Review

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

The Haskell project is due at 11:59pm TONIGHT. The rubric used to grade this assignment is now available.

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
12/20/2016
final exam 1-3pm
study: old exams