CS 331 Spring 2013: Programming Languages

CS 331 Spring 2013
Programming Languages

Department: Computer Science, UAF
Instructor: Glenn G. Chappell
Office: 201B Chapman
Office Hours: 11:45–1:45 MWF, 9:30-11:30 T, 2:00-3:00 T on spring 2013 class days, or by appointment
Office phone: (474-)5736
E-mail: ggchappell@alaska.edu
Paper mailbox: Inside the CS Department office, 202 Chapman

Announcements

Course Materials

Materials are listed with the most recent at the top.

Week Class Meetings Readings & Homework Handouts, Sample Code, Etc.
Week 15 
& Finals 
5/6–5/10 
   
Week 14 
4/29–5/3 
  • 5/3: Student presentations (see schedule)
  • 5/1: Student presentations (see schedule)
  • 4/29: Student presentations (see schedule)
 
Week 13 
4/22–4/25 
  • 4/26: No class (UAF SpringFest)
  • 4/24: Class cancelled
  • 4/22: Notes on scope & lifetime; sample presentation
   
Week 12 
4/15–4/19 
  • 4/19: Notes on typing
  • 4/17: Prolog
  • 4/15: Prolog
   
Week 11 
4/8–4/12 
  • 4/12: Prolog
  • 4/10: Introduction to Prolog
  • 4/8: Forth: Allocation & I/O; Forth: Syntax
 
  • forth_io.fs [Forth source]
    Code from 4/8: Forth: Allocation & I/O
    Written Mon 4/8
Week 10 
4/1–4/5 
  • 4/5: Presentation sign-up; Forth
  • 4/3: Forth
  • 4/1: Introduction to Forth
 
Week 9 
3/25–3/29 
  • 3/29: Scheme: Macros
  • 3/27: Scheme: Types
  • 3/25: Scheme: Lists, functions, trees
  • pa5_test.py [Python 3 source]
    Test program for Assignment 5 class & functions
    Used in Assignment 5, Exercise A
    Written Tue 3/26
  • scheme_list.scm [Scheme source]
    Code from 3/25: Scheme: lists, functions, trees
    Written Mon 3/25
Week 8 
3/18–3/22 
  • 3/22: Introduction to Scheme
  • 3/20: Python: flow of control
  • 3/18: Python: Iterators
  • scheme_intro.scm [Scheme source]
    Code from 3/22: Introductory Scheme
    Written Fri 3/22
Spring Break   
Week 7 
3/4–3/8 
  • 3/8: Class cancelled
  • 3/6: Midterm Exam
  • 3/4: Python: values & functions
 
Week 6 
2/25–3/1 
  • python_intro.py [Python 3 source]
    Code from 3/1: Introductory Python
    Written Fri 3/1
  • Quiz 3 Solutions [PDF]
    Quiz given Fri 3/1
  • haskell_more.hs [Haskell source]
    Code from 3/1: just a bit more Haskell
    Written Fri 3/1
  • haskell_io.hs [Haskell source]
    Code from 2/27: Haskell I/O
    Written Wed 2/27
  • pa4_test.hs [Haskell source]
    Test program for Assignment 4 functions & variables
    Used in Assignment 4, Exercise B
    Written Tue 2/26
  • check_haskell.hs [Haskell source]
    A Haskell program to run
    Used in Assignment 4, Exercise A
    Written Mon 2/25
  • haskell_flow.hs [Haskell source]
    Code from 2/25: Haskell flow of control
    Written Mon 2/25
  • Favorite.hs [Haskell source]
    Example Haskell module to import
    Written Mon 2/25
    Distributed in class Mon 2/25
  • fullprog1.hs [Haskell source]
    Example Haskell program that does an import
    Written Mon 2/25
    Distributed in class Mon 2/25
Week 5 
2/18–2/22 
 
Week 4 
2/11–2/15 
  • 2/15: Specifying semantics
    Lecture notes
  • 2/13: Shift-Reduce parsing (cont’d); categories of parsers
    Lecture notes
  • 2/11: Recursive-Descent parsing (cont’d); Shift-Reduce parsing
    Lecture notes
  • rdparse2_test.cpp [C++ source]
    Test program for class RDParse2
    Also requires lex2.h/.cpp
    Used in Assignment 3, Exercise A
    Written Sun 2/17
    Updated Thu 2/21
  • rdparseb_main.cpp [C++ source]
    Quick main program for class RDParseb
    Also requires lex.h/.cpp
    Written Mon 2/11
  • rdparseb.h [C++ header]
    Header for class RDParseb
    Second Recursive-Descent parser
    Written Mon 2/11
  • rdparseb.cpp [C++ source]
    Source for class RDParseb
    Second Recursive-Descent parser
    Written Mon 2/11
  • Shift-Reduce Parsing Table [PDF]
    Distributed in class Mon 2/11
Week 3 
2/4–2/8 
  • rdparse_main.cpp [C++ source]
    Quick main program for class RDParse
    Also requires lex.h/.cpp
    Written Fri 2/8
  • rdparse.h [C++ header]
    Header for class RDParse
    First Recursive-Descent parser
    Written Fri 2/8
  • rdparse.cpp [C++ source]
    Source for class RDParse
    First Recursive-Descent parser
    Written Fri 2/8
  • lex2_test.cpp [C++ source]
    Test program for class Lex2
    Used in Assignment 2, Exercise A
    Written Wed 2/6
  • Lexeme Description [PDF]
    For in-class lexical analyzer project
    Distributed in class Mon 2/4
Week 2 
1/28–2/1 
  • lex_main.cpp [C++ source]
    Quick main program for class Lex
    Written Fri 2/1
    Revised Mon 2/4
  • lex.h [C++ header]
    Header for class Lex
    State-machine-based lexical analyzer
    Written Fri 2/1
    Partially distributed in class Mon 2/4
    Revised Mon 2/4
  • lex.cpp [C++ source]
    Source for class Lex
    State-machine-based lexical analyzer
    Written Fri 2/1
    Partially distributed in class Mon 2/4
    Revised Mon 2/4
Week 1 
1/22–1/25 
 
Week 0 
1/17–1/18 
  • 1/18: Course overview; introduction to syntax & semantics; languages & grammars
    Lecture notes
  • 1/18: Read Five Dollar Programming Words.
    Note: The above date is when the reading is assigned. It should be done by the next class meeting (Wednesday 1/23 in this case).
External links last checked February 28, 2013.
Links to supplemental readings will be posted here as they are assigned. Links to these will also be in the “Readings & Homework” column of the Course Materials section, above.
Five Dollar Programming Words
This blog post on Coding Horror, by Jeff Atwood, gives a nice explanation of some tricky terminology.
Learn Haskell in 10 minutes
A short introduction to Haskell, for people who already know something about programming, from HaskellWiki.
Learn Python in 10 minutes
A short introduction to Python, by Stavros Korokithakis. This covers an earlier version of the language than the one we will be studying. So note that print now requires parentheses: write “print(x)” instead of “print x”. (Despite the similar title, this appears to be unrelated to the Haskell reading.)
Quick: An Introduction to Racket with Pictures
A quick introduction to Racket, a variety of Scheme, from the Racket website. This introduction discusses graphics functionality that we will not be covering, but otherwise gives a good overview of how Racket works.
Crash Course in Forth
A brief introduction to Forth, by Swedish engineer Edward Paley. This does not cover Gforth (the version we will use), but it is correct for our version, up to “Compiling words”.


CS 331 Spring 2013 / Updated: 8 May 2013 / Glenn G. Chappell / ggchappell@alaska.edu