CS 331 Spring 2009: Programming Languages

CS 331 Spring 2009
Programming Languages

Department: Computer Science, UAF
Instructor: Glenn G. Chappell
Office: 201B Chapman
Office hours on spring 2009 class days: 10:30 a.m. & 3:30 p.m. MWF, or by appointment
Office phone: (474-)5736
E-mail: ffggc@uaf.edu
Paper mailbox: Inside the CS Department office, 202 Chapman

Announcements

Course Materials

Materials are listed with the most recent at the top. See below for links.

Week Class Meetings Readings & Homework Handouts, Sample Code, Etc.
Week 14
& Finals 
5/4–5/8 
  • 5/6: Final Exam 1–3 p.m. in the classroom
  • 5/4: Notes on the Final Exam (part II)
 
Week 13 
4/27–5/1 
  • 5/1: Student presentations
  • 4/29: Student presentations
  • 4/27: Notes on the Final Exam (part I); student presentations
   
Week 12 
4/20–4/24 
  • 4/24: No class (UAF SpringFest)
  • 4/22: Student presentations
    (see schedule)
  • 4/20: Prolog (cont’d); example presentation
Week 11 
4/13–4/17 
  • 4/17: Prolog (cont’d)
  • 4/15: Prolog
    Text 16.5–16.7. Slides: Ch 16 #19–37.
  • 4/13: Logic programming
    Text 16.1–16.4. Slides: Ch 16 #1–18.
 
  • pa4_test.py [Python 3 source]
    Test Program for Assignment 4 Functions & Classes
    Python 3 version
    Used in Assignment 4
    Posted Wed 4/15
  • pa4_test_py2.py [Python 2 source]
    Test Program for Assignment 4 Functions & Classes
    Python 2 version
    Used in Assignment 4
    Posted Wed 4/15
  • code_2009_04_15.pro [Prolog source]
    Sample Prolog Code
    From the Wed 4/15 class meeting
    Posted Wed 4/15
Week 10 
4/6–4/10 
  • 4/10: Forth
  • 4/8: Forth: basics (cont’d)
  • 4/6: Forth: the Language; Forth: basics
   
Week 9 
3/30–4/3 
  • 4/3: Expressions in programming languages
    Text 7.1–7.3, 7.6. Slides: Ch 7 #2–14, 23. Additional notes.
  • 4/1: More Python
  • 3/30: Python: iterator, exceptions, lists (cont’d)
  • code_2009_04_03.py [Python 3 source]
    Sample Python Code
    From the Fri 4/3 class meeting
    Posted Sat 4/3
Week 8 
3/23–3/27 
  • 3/27: Python: iterators, exceptions, lists
  • 3/25: Python: the language; Python: basics
  • 3/23: Names in programming languages (cont’d)
    Text 5.4.3–5.10. Slides: Ch 5 #18b–41. Additional notes.
 
Week 7 
3/16–3/20 
  • 3/20: Names in programming languages
    Text 5.1–5.4.2. Slides: Ch 5 #1–18a.
  • 3/18: In-Class Midterm Exam
  • 3/16: Class Cancelled.
   
Spring Break  
Week 6 
3/2–3/6 
  • 3/6: Haskell: I/O (cont’d); Haskell: types, type classes, monads
    Notes.
  • 3/4: Haskell: I/O
    Notes.
  • 3/2: Haskell: lists & loops (cont’d)
  • code_2009_03_06.hs [Haskell source]
    Sample Haskell Code
    From the Fri 3/6 class meeting
    Posted Sun 3/8
  • Midterm Exam Topics
    Posted Sat 3/7
  • code_2009_03_04.hs [Haskell source]
    Sample Haskell Code
    From the Wed 3/4 class meeting
    Posted Wed 3/4
  • pa3_test.hs [Haskell source]
    Test Program for Assignment 3 Functions & Variables
    Used in Assignment 3, Exercise A
    Posted Tue 3/3
    Revised Thu 3/5
  • code_2009_03_02.hs [Haskell source]
    Sample Haskell Code
    From the Mon 3/2 class meeting
    Posted Mon 3/2
Week 5 
2/23–2/27 
  • 2/27: Haskell: lists & loops (cont’d)
  • 2/25: Haskell: basics (cont’d); Haskell: lists & loops
  • 2/23: Haskell: the language; Haskell: basics
    Notes.
Week 4 
2/16–2/20 
  • 2/20: Bottom-up parsing (cont’d)
    Text 4.5. Slides: Ch 4 #36–46. Additional notes.
  • 2/18: Recursive-descent parsing (cont’d); bottom-up parsing
  • 2/16: Recursive-descent parsing (cont’d)
  • Assignment 2
    Due Tue 2/24
    Posted Sun 2/15
    Revised (error fixed) Sun 2/22
  • LR Parsing Table Handout
    From pp 193–194 in the text
    This handout will not be posted
    Distributed in class Fri 2/20
Week 3 
2/9–2/13 
  • 2/13: Recursive-descent parsing (cont’d)
  • 2/11: The parsing problem; recursive-descent parsing
  • 2/9: Lexical analysis (cont’d)
  • 2/11: Read 4.5.
  • 2/9: Read 4.3.
Week 2 
2/2–2/6 
  • 2/6: Lexical analysis (cont’d)
  • 2/4: Lexical analysis
    Text: 4.1–4.2. Slides: Ch 4 #2–15 (not shown in class). Additional notes.
  • 2/2: Dynamic semantics
    Text: 3.5. Slides: Ch 3 #29–52 (not shown in class).
  • lex.h [C++ header]
    Header for class Lex
    Lexical analyzer class
    Posted Thu 2/5
    Distributed in class Fri 2/6
    Revised Fri 2/6
    Distributed in class Mon 2/9
    Revised Mon 2/9
  • lex.cpp [C++ source]
    Source for class Lex
    Lexical analyzer class
    Posted Thu 2/5
    Distributed in class Fri 2/6
    Revised Fri 2/6
    Distributed in class Mon 2/9
    Revised Mon 2/9
  • lex_main.cpp [C++ source]
    Main program for class Lex
    Lexical analyzer class
    Posted Thu 2/5
    Distributed in class Fri 2/6
    Revised Fri 2/6
    Distributed in class Mon 2/9
    Revised Mon 2/9
  • Lexeme Description [PDF]
    Description of lexemes to write an analyzer for
    Posted Wed 2/4
    Distributed in class Wed 2/4
  • prog1.hs [Haskell source]
    Sample Haskell Program
    Used in Assignment 1, Exercise A
    Posted Tue 2/3
Week 1 
1/26–1/30 
  • 1/30: Attribute grammars
    Text: 3.4. Slides: Ch 3 #22–28.
  • 1/28: Formal methods of syntax description (cont’d); a brief introduction to Haskell
    Text: 3.3 (cont’d). Slides: Ch 3 #17–21. Additional notes.
  • 1/26: Describing syntax; formal methods of syntax description
    Text 3.1–3.3. Slides: Ch 3 #1–16. Additional notes.
  • 1/28: Read: 3.4.
  • 1/26: Read: 3.3.
Week 0 
1/22–1/23 
  • 1/23: Course overview; why study programming languages; programming domains; evaluating languages
    Text 1.1–1.3. Slides: Ch 1 #3–10.
  • 1/23: Read 1.5, 1.6, 1.7 in the text.
    Note: The above date is the date the reading is assigned. Generally, you should have done the reading by the next class meeting, Monday 1/26 in this case.

External links last checked March 23, 2009.

Text Website: Free Stuff
A directory containing PowerPoint slides covering the material in our text.
Text Website: Non-Free Stuff
The not-so-free companion website for our text. A new copy of the text comes with six months paid access to this site. Access to this site is not required for the class.
Haskell.org
The main Haskell web page. Includes links to tutorials and lots of other stuff.
Hugs 98
The Hugs interactive Haskell system.
GHC
The Glasgow Haskell Compiler.

Links to supplemental readings will be posted here as they are assigned. Links to these can also be found in the “Readings & Homework” column of the Course Materials section, above.

Learn Haskell in 10 minutes
A short introduction to Haskell, for people who already know something about programming.
Learn Python in 10 minutes
A short introduction to Python, somewhat coincidentally titled much the same as the previous link.
An Operational Semantics for Python
In this blog post, the author (Gideon Smeding) writes about his project of writing an operational semantics for a small subset of Python, called “minpy”, in Haskell. The article is heavy on mathematical notation; it is also not long.
On the use of parser/lexer generators
This blog post gives a nice summary of the trade-offs involved in automatically generated lexers and parsers vs. manually written ones. And the author (Dominique Boucher) appears to have much more real-world knowledge of the subject than I do. This post is a response to another blog post (this one by Avery Pennarun), which I think is also worth reading.
Five Dollar Programming Words
This blog post on Coding Horror, by Jeff Atwood, gives a nice explanation of “orthogonality” (and other terms).


CS 331 Spring 2009 / Updated: 5 May 2009 / Glenn G. Chappell / ffggc@uaf.edu Valid HTML 4.01!