Structures of Programming Languages (CSCI 117) : Dr. Todd Wilson, Spring 2021

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Structures of Programming Languages (CSCI 117)

Dr. Todd Wilson, Spring 2021

Course Information
Item Lectures Labs Office Hours
Zoom Links and MWF 8:00a – 8:50a (37159) M 10:00 – 12:00 (37161) Consultation Link
Time (Sched #): M 3:30 – 5:20 (37162) M 1:00pm-2:50pm
T 1:00pm-2:50pm
W 2:00pm-3:50pm

Canvas Course: CSCI117-01-37159-2213

Piazza: https://piazza.com/fresnostate/spring2021/csci117/home
Instructor: Todd Wilson (twilson@csufresno.edu, 278-9138),
but please use Piazza (privately if necessary) to contact me

Introduction and Course Description


CSci 117, Structures of Programming Languages, is a 4-unit course that introduces you to
programming language concepts, techniques, and models. Topics include programming
paradigms, semantics, data abstraction, concurrency, and practical techniques. Although focusing
primarily on general principles and not specific programming languages, course topics and
concepts are made concrete through lab assignments involving the programming languages
Haskell, Oz, and Prolog. Several other programming languages are surveyed.

Prerequisites
CSci 117 has both CSci 41 and CSci 60 as prerequisites, although we will relying only indirectly
on the material from these courses. Instead, we will be building directly on the foundations of
functional programming and machine models, which we will introduce from scratch.

Course Materials
The main textbook and source of information for the course is

Peter Van Roy, Seif Haridi, Concepts, Techniques, and Models of Computer
Programming, June 5, 2003. (I’ll refer to this book as CTM.)

Although an older book, it was written from a higher-level perspective and remains the best
source of theoretical and practical information on programming paradigms available (IMHO).
This textbook introduces and illustrates programming language concepts, techniques, and models

1
using the Oz programming language. It is a kind of “universal language” that coherently includes
features from all programming paradigms and supports all of the various programming
techniques we will discuss. This allows us to take a unified and highly efficient approach to the
subject, which incrementally builds on top of what has come before instead of starting from
scratch for each paradigm. You will be using an Oz interpreter that I’ve written in Haskell, which
will serve as both an illustration of a larger Haskell program and as a model realization of the
semantics of the core Oz language. It interprets a slightly modified subset of Oz. Although not
required, you may also find it helpful to install the latest version of the Mozart Programming
System, which can be used to run (and debug) Oz programs and has more features than my
interpreter. You'll want version 2.

We will be making extensive use of the functional programming language Haskell in this course.
It will be both our main example of the functional paradigm, as well as the implementation
language for my Oz interpreter, and you will be working extensively with it in labs. Your best
bet for getting Haskell is to install the Haskell Platform, which includes many extra tools and
libraries, and is therefore large. Students having less disk space (or download time) can opt to
install only GHC, the Glasgow Haskell Compiler, which also contains the interactive ghci
environment and is probably available in binary format through your system's package manager
and will have everything that you need. There is also a browser-based implementation of Haskell
that doesn’t require any download at all and may be useful until you can get a full installation on
your machine. The advantages of using Haskell for this course are (1) the core of the language is
"simple" to learn, in that there is a minimum of syntax and concepts, keeping the language
concise and predictable; (2) being a pure functional language, it is very close to mathematics, the
language we use to express our concepts, which can therefore often be translated directly into
code; and (3) through ghci, it is highly interactive, meaning that it is easy to experiment and get
immediate feedback.

Self-study materials for Haskell include these two tutorials:

Miran Lipovača, “Learn You a Haskell for Great Good!” (LYaH), chapters 1-8.

Stephen Diel, “What I Wish I Knew When Learning Haskell” (WIWIK), sections

• What is Haskell, How to Read


• Prelude, Modern Haskell
• GHCi, .ghci.conf, Editor Integration
• and then everything from Names to Typeclasses.
A number of other beginning materials on Haskell, if needed, can be found in

• a nice Haskell Beginners Tutorial from Monday Morning Haskell

• an extensive list of resources for Learning Haskell from the Haskell Wiki.

If you want to brush up on your Discrete Mathematics background while seeing how it all can be
programmed in Haskell, I can recommend these textbooks:

2
John O’Donnell, Cordelia Hall, and Rex Page, Discrete Mathematics Using a Computer,
Second Edition, Springer, 2006.

Kees Doets and Jan van Eijck, The Haskell Road to Logic, Math and Programming,
March 4, 2004.

Logic and constraint programming, although directly supported by Oz, will be covered instead
using Prolog, the original logic-programming language, although we will also be looking at logic
programming in Oz, as well as learning how to achieve many of the same results in Haskell.
There are browser-based Prolog environments, like SWISH, as well as full-fledged Prolog
compilers, like Gnu Prolog. You will need to use either or both for some lab assignments.

Links to and/or PDF versions of all of these and other resources are provided in the Resources
section of Piazza. In addition, you can find many other free resources covering the topics of the
course on the Web, starting with Wikipedia, although you should note that authors often have
their own conventions and notations, sometimes contradicting the ones in the official resources
above, so be careful.

Course Organization and Schedule


I’ve divided the course into weeks, which are reflected in Canvas as Modules, with
approximately two weeks devoted to each paradigm that we will be covering: functional,
declarative, declarative concurrency, logic/constraint programming, explicit state, and distributed
programming. Additional time has been reserved for expanding on some topics, summarizing
some new ones, and allowing us to catch up if we get a little behind. The schedule of the lectures
and reading assignments for each lecture are given in the table below:

Week/ Topics Readings


Module
Paradigm: Functional
1 Basic Haskell: data, operations, types, functions, control LYAH Ch. 1-8,
WIWIK various sections
Functional techniques: Recursion, iteration, implicit state, Skim CTM 3.2 – 3.4
and accumulators
2 Higher-order programming and correctness: control Skim CTM 3.6
abstractions, explicit laziness, equational reasoning,
recursive invariants
ADTs, type classes, and program structure Skim CTM 3.7, 3.9
Paradigm: Declarative
3 General syntax and semantics, compiler phases, semantics CTM 2.1
of the functional model: environments, the heap, closures,
evaluation

3
Syntax and semantics of the declarative model: single- CTM 2.2 – 2.4
assignment store, unification, Oz kernel syntax, kernel
semantics
4 Syntactic sugar, practical language constructs, elaboration, CTM 2.5 – 2.6
functional as declarative, exceptions
Partial data structures and declarative techniques CTM 3.4 – 3.6 revisited
Paradigm: Declarative Concurrency and Laziness
5 Data-driven concurrency and threads, semantics of threads CTM 4.1 – 4.2
Concurrent programming, streams, bounded buffer example CTM 4.3
6 Semantics of laziness, lazy streams, and the Hamming CTM 4.5
problem
(Dis)advantages of the declarative model CTM 4.7
Paradigm: Logic (aka Relational) and Constraint Programming
7 Basic Prolog and its relation to constructive logic and Skim CTM 9.1
backtracking proof search
Examples of logic programs, converting between functional Skim CTM 9.2
and logic programs
8 Case study: Natural language parsing CTM 9.4
Constraint programming in Prolog and examples Skim CTM 12.1 – 12.3
9 Constraint programming continued SWISH examples
Paradigm: Imperative (aka Explicit State)
10 Cells and the mutable store, stateful techniques CTM 6.1 – 6.3
Data organization and encapsulation: names, bundling, CTM 6.4 – 6.5
ADTs (8 ways), parameter passing, collections
11 Reasoning with state and invariants, program design CTM 6.6 – 6.7
Case study: Transitive Closure CTM 6.8.1
Paradigm: Distributed Programming
12 Message-passing concurrency: ports, protocols, Skim CTM Ch.5
programming techniques
13 Distributed Programming: data and state distribution, Skim CTM Ch.11
patterns and protocols, partial failure
Other Topics (time permitting), Overflow, and Review
14 Object-oriented programming Skim CTM Ch.7
Graphical User Interface programming Skim CTM Ch.10
15 Overflow and final review

4
Exam creation assignments
Instead of traditional timed online exams, you will instead be given regular “exam creation
assignments”, one for each paradigm covered (6 total). In these assignments, you will be creating
a collection of quality exam/quiz questions in different formats (multiple choice, multiple
answer, fill in the blank, etc.). A quality multiple-choice question, for example, is one that is
(1) not easily guessed by someone who hasn’t learned the topic, and (2) has plausible distractors
that each catches a different common error. You may also be asked to provide feedback for your
each of your distractors that could be usefully given to someone choosing this as an answer.
Your questions will be simply graded as satisfactory or unsatisfactory, and you will be allowed
to resubmit fixes for unsatisfactory questions. Your final grade for the exam creation assignment
will be determined by the overall scope of the satisfactory questions you submit and how well
they indicate your understanding of the associated course material. As a side benefit of your
efforts, I will be accumulating your satisfactory questions into a quiz bank that will be made
available to all students for practice and will be drawn upon to create the (timed) final exam.

These exam-creation assignments will count for 48% of your final grade (= 6 x 8%).

Final Exam
You will be given a final exam made up of the questions that you’ve created in your exam-
creation assignments throughout the semester. It is meant to be a low-stakes, timed activity and
will count as 10% of your grade.

Labs
Roughly each week, there will be a lab assignment, officially due the night before the next lab. If
the lab meeting falls on a holiday, there will still be a lab assignment but no meeting. These
assignments may involve programming in Haskell, Oz, or Prolog, and/or providing written
answers to open-ended questions. A recorded and/or written description of the lab may be made
available in advance, and the lab meeting will begin with a Q&A period to clarify any issues you
might have about the assignment. You will then be broken into groups of two to work on the lab
assignment with a partner. About 10 minutes before the end of the lab period, we will reconvene
as a class to discuss any remaining issues. You will also be asked to write brief summaries of
your interaction with your lab partner as private chat messages to the lab instructor. These should
(1) mention your lab partner by name, (2) indicate which part(s) of the lab assignment you
worked on, and (3) what your individual contributions were to what you completed. If your
partner was not cooperative or checked out, please say so. At the end of the lab, make a copy of
any joint work you developed with your partner; from that point on, you will be working on your
own to complete the lab by yourself. Labs are worth a total of 25% of your grade.

5
Participation/Engagement
A participation/engagement component of your grade, worth 17%, will reflect three aspects of
course engagement:
• Piazza (7%). We will be using Piazza for course Q&A. Students can ask, answer, and
modify the questions and answers of other students, and receive endorsements from
instructors for good answers. The Piazza system keeps track of student contributions and
endorsements throughout the semester, and the Piazza component of your participation
grade will be computed from these statistics.
• Canvas (6%). Our modules on Canvas will contain some summary readings, surveys,
practice quizzes, and other small tasks. Canvas keeps track of your engagement in these
activities, and the Canvas component of your participation grade comes from these
statistics.
• Lab attendance and engagement (4%). For each lab meeting, you will receive a score
for attending and actively working on your assignment, as determined through the Zoom
meeting logs for the lab and private summary messages, which will be totaled to make up
the Lab component of your participation grade.

Make-ups
This semester, although deadlines are set for exams, labs, and other activities, I will generally not
be enforcing these deadlines, meaning that there will not be a formal penalty for missing a
deadline. However, as tempting as it may be at times to let deadlines slide, please be aware that
the rest of the semester will not wait for you to turn in late work, and that new tests, labs, and
activities will follow closely on the completion of the prior ones, and that new material generally
builds on previous material rather than simply starting over. In short, be very careful about
missing deadlines: if you fall behind, you may find it very difficult to catch up and end up
wasting the entire semester.

Also, if you are absent from class or a lab, it is your responsibility to check on anything you
might have missed. I’ll be making recordings of my lectures and lab intros, but not the lab
meetings or office hours. Don’t ask me to repeat something to you individually that I already told
the class when you weren’t there, and don’t expect other students to drop what they are doing
and fill you in either.

Study Expectations
It is usually expected that students will spend approximately 2 hours of study time outside of
class for every one hour in class. Since this is a 4-unit class, you should expect to spend an
average of 8 hours outside of class each week on course-related work (reading, study, test
creation, lab assignments, etc.). Some students may need more outside study time and some less.

6
Grading
To summarize the grading information above, your total score for this course is weighted as:

Item Weight
Exam creation assignments 48%
Final Exam 10%
Labs 25%
Participation/Engagement 17%

Your letter grade will be based on your total score, including a class-wide adjustment1 added to
all student scores, according to the following scale:

Range Grade
88% - 100% A
75% - 88% B
62% - 75% C
50% - 62% D
0% - 50% F

Course Goals and Primary Learning Outcomes


Course Goals

The goals of this course are to (1) develop a detailed understanding of the concepts, techniques,
and models of computer programming and how these can be implemented; and (2) learn to apply
this knowledge to computer programming problems – including design, organization,
construction, and validation – as well as new language learning.

Detailed Learning Outcomes

After successful completion of this course, students should be able to:

1. Trace the execution of simple multi-paradigm programs using a formal semantics,


including those involving parameter passing, state, exceptions, objects, and concurrency.

1 the purpose of the adjustment is to compensate for semester-specific deviations in course difficulty that are
outside of student control (harder tests, inadvertently misleading questions, less time allotted for work, etc.)

7
2. Implement functions on inductive and declarative data structures such as lists, trees,
difference lists, and streams.

3. Implement recursion using iteration and a stack, and establish and verify invariants of
programs with loops and recursion.

4. Solve search problems using logic and constraint programming.

5. Construct ADTs and information hierarchies for various data abstractions.

6. Use ports to structure and implement distributed programs.

7. Reason about programs with state and distribution.

Subject to Change Statement


The contents of this syllabus are subject to change in the event of extenuating circumstances.

University Policies
Contact information for Chair and Dean:

If there are questions or concerns that you have about this course that you and I are not able to
resolve, please feel free to contact the Chair of the Department to discuss the matter, and if that
still doesn’t resolve the matter, the Dean of the College:
• Chair, Department of Computer Science: Alex Liu (shliu@mail.fresnostate.edu)
• Dean, College of Science and Mathematics: Chris Meyer (cmeyer@mail.fresnostate.edu)

Students with Disabilities:

Upon identifying themselves to the instructor and the university, students with disabilities will
receive reasonable accommodation for learning and evaluation. For more information, contact
Services to Students with Disabilities in the Henry Madden Library, Room 1202 (278-2811).

Honor Code:

“Members of the CSU Fresno academic community adhere to principles of academic integrity
and mutual respect while engaged in university work and related activities.” You should:

a) understand or seek clarification about expectations for academic integrity in this course
(including no cheating, plagiarism and inappropriate collaboration)

8
b) neither give nor receive unauthorized aid on examinations or other course work that is
used by the instructor as the basis of grading.

c) take responsibility to monitor academic dishonesty in any form and to report it to the
instructor or other appropriate official for action.

Cheating and Plagiarism:

"Cheating is the actual or attempted practice of fraudulent or deceptive acts for the purpose of
improving one's grade or obtaining course credit; such acts also include assisting another student
to do so. Typically, such acts occur in relation to examinations. However, it is the intent of this
definition that the term 'cheating' not be limited to examination situations only, but that it include
any and all actions by a student that are intended to gain an unearned academic advantage by
fraudulent or deceptive means. Plagiarism is a specific form of cheating which consists of the
misuse of the published and/or unpublished works of others by misrepresenting the material (i.e.,
their intellectual property) so used as one's own work." Penalties for cheating and plagiarism
range from a 0 or F on a particular assignment, through an F for the course, to expulsion from the
university. For more information on the University's policy regarding cheating and plagiarism,
refer to the Class Schedule (Legal Notices on Cheating and Plagiarism) or the University Catalog
(Policies and Regulations).

Computers:

"At California State University, Fresno, computers and communications links to remote
resources are recognized as being integral to the education and research experience. Every
student is required to have his/her own computer or have other personal access to a workstation
(including a modem and a printer) with all the recommended software. The minimum and
recommended standards for the workstations and software, which may vary by academic major,
are updated periodically and are available from Information Technology Services
(http://www.fresnostate.edu/adminserv/technology/) or the University Bookstore. In the
curriculum and class assignments, students are presumed to have 24-hour access to a computer
workstation and the necessary communication links to the University's information resources."

In addition to the university requirements for computers, students in CSci 60 are required to
bring a laptop with them to lab.

Disruptive Classroom Behavior:

"The classroom is a special environment in which students and faculty come together to promote
learning and growth. It is essential to this learning environment that respect for the rights of
others seeking to learn, respect for the professionalism of the instructor, and the general goals of
academic freedom are maintained. ... Differences of viewpoint or concerns should be expressed
in terms which are supportive of the learning process, creating an environment in which students
and faculty may learn to reason with clarity and compassion, to share of themselves without
losing their identities, and to develop and understanding of the community in which they live . . .

9
Student conduct which disrupts the learning process shall not be tolerated and may lead to
disciplinary action and/or removal from class."

Copyright Policy:

Copyright laws and fair use policies protect the rights of those who have produced the material.
The copy in this course has been provided for private study, scholarship, or research.  Other uses
may require permission from the copyright holder.  The user of this work is responsible for
adhering to copyright law of the U.S. (Title 17, U.S. Code). To help you familiarize yourself
with copyright and fair use policies, the University encourages you to visit its Copyright Web
Page (http://libguides.csufresno.edu/copyright).

Technology Innovations for Learning & Teaching (TILT) course web sites contain material
protected by copyrights held by the instructor, other individuals or institutions. Such material is
used for educational purposes in accord with copyright law and/or with permission given by the
owners of the original material.  You may download one copy of the materials on any single
computer for non-commercial, personal, or educational purposes only, provided that you (1) do
not modify it, (2) use it only for the duration of this course, and (3) include both this notice and
any copyright notice originally included with the material.   Beyond this use, no material from
the course web site may be copied, reproduced, re-published, uploaded, posted, transmitted, or
distributed in any way without the permission of the original copyright holder.  The instructor
assumes no responsibility for individuals who improperly use copyrighted material placed on the
web site.

Intellectual Property:

As part of your participation in virtual/online instruction, please remember that the same student
conduct rules that are used for in-person classrooms instruction also apply for virtual/online
classrooms.  Students are prohibited from any unauthorized recording, dissemination, or
publication of any academic presentation, including any online classroom instruction, for any
commercial purpose.  In addition, students may not record or use virtual/online instruction in any
manner that would violate copyright law.  Students are to use all online/virtual instruction
exclusively for the educational purpose of the online class in which the instruction is being
provided.  Students may not re-record any online recordings or post any online recordings on any
other format (e.g., electronic, video, social media, audio recording, web page, internet, hard
paper copy, etc.) for any purpose without the explicit written permission of the faculty member
providing the instruction.  Exceptions for disability-related accommodations will be addressed by
Services for Students with Disabilities (SSD) working in conjunction with the student and
faculty member.

COVID-19 related provisions

Health Screening:
 

10
Students who come to campus for face-to-face classes will be required to complete a daily health
screening which will include temperature checks. If you have experienced COVID-19 symptoms
and/or have tested positive within the past 10 days; or if you have had close contact (less than 6
feet for longer than 15 minutes while unmasked) with a suspected or confirmed COVID-19
patient within the past 14 days, you are not allowed to come to campus.  Please complete the
campus online reporting form.  A campus official will reply to provide guidance and
information.    
 

Safety Measures: Consistent with the Governor’s order and updated state public-health
guidelines, face masks or cloth face coverings are required to be worn in public spaces on-
campus and during in-person classes to reduce possible exposure to COVID-19 and prevent the
spread of the virus. Physical distancing must be practiced by maintaining 6 feet of distance
between individuals. Good hygiene of hand washing for a minimum of 20 seconds or using hand
sanitizer is required. Please avoid touching your face with unclean hands. Disposable face masks
will be provided to anyone who arrives to campus without one.
 
Please see university website for the most updated information: www.fresnostate.edu.

11

You might also like