198:314 Principles of Programming Languages
Fall 2001
Programming Assignments
It is your responsibility to hand in a program that
loads/compiles properly on remus. We will not make any changes to
submitted programs.
All assignments are due by midnight of the due date stated (i.e.,
due on Oct 5 means by 23:59:59 on Oct 5)
Electronic Handin Procedures
All assignments will be turned in using the handin program. To submit
an assignment named proAssign.pl, you type:
handin cs314-{myinstructor}.proj* proAssign.pl
The possible substitutions for {myinstructor} are: borgida, kremer,
ryder.
The possible substitutions for * are 1,2,3,4 depending on which
assignment you are submitting throughout the semester.
To check that you handed in the first assignment successfully, for example,
type:
handin -l cs314-{myinstructor}.proj1
In the parameter to handin, that's a lower case "L" not the number
1. To find out more about the handin program type:
man handin
on remus or romulus.
Assignments
-
Prolog Assignment (80+
points)
-
Grading
Rules & FAQ
-
Solution
-
September 24: Assumptions added for Part I: no administration starts and
ends in the same year, and administrations are "contiguous" (i.e., when
one ends, another one begins); for testing 'after', things are easier if
you assume each administration has a different president.
The following two files contain facts about presidents, which you can
use to test your predicates.
-
September 19: Clarification to part I: The text has been edited to indicate
that the years of an administration need not be integers; they could be
roman numerals, for example. Also, the 'follows' predicate means 'immediatelyFollows'
(example corrected).
-
Links to Prolog implementations/environments
-
Distributed: September 17, 2001; Due: October 5, 2001
-
C Assignment (60
points)
-
Distributed: October 6, 2001
Due: October 19, 2001
-
Grading
Scheme
-
Solution
-
All testmains except testmain7 and all test data
have been accessible since Friday off the grading explanation page under
the C project.
For ease of examining these files we are listing them
here as well.
-
FAQ
-
#define TOPN , referred to below, will be put it in the concor.h
file; but if you got your program to work otherwise, don't worry.
-
We see no reason for you to submit concor.h and main.c files. Especially
the last one is for testing.
-
October 10, 2001:
-
There were 2 typos (a mispelling of the function named create_index())
in the concor.h and main.c files which now have been fixed.
-
Also, in order to run a program in C and to have it use input from a file
as though you typed this input at your terminal, use the following commands:
/* this compiles your C program in file foo.c */
%remus> gcc foo.c
/*The C program is translated by the C compiler (gcc) into an executable,
stored in a file called a.out. Assume that the data that we would
normally type at the terminal, is stored in a file called
data..
The following command causes the program to read from file data
as though it were reading input from the terminal.
%remus> a.out < data
If this command does not work for you, try typing the following instead:
%remus> ./a.out < data
-
The last submission time for the C assignment as LATE (in order to obtain
any points) is midnight, Tuesday, October 23, 2001. This is because
we need to be able to post the answer to the assignment for students to
study for our midterm on Thursday, October 25, 2001.
-
October 9, 2001: There is an alternative (and better) way to make
top_freq() independent of the number of top frequency words desired.
If you add #define TOPN 5 to the concur.h file, then the c preprocessor
expands TOPN wherever it occurs in the program into the constant 5. Thus,
you can write your program independent of the choice of this number by
using TOPN. This is better programming practice than our previous suggestion
of making
n a const variable, which will only enforce at
run-time the rule that n cannot have its value changed. All you
have to do to change the value of TOPN used from one run of the program
to the next is to change the one line of the header file.
-
C++ Assignment(80 points) in
Postscript or in PDF
-
Distributed: October 31, 2001, midnight
Due: November 18, 2001
-
Please copy all files in the directory
~www/Public/cs314/f2001/projs/C++/students
into your own subdirectory. This is a collection of *.h
and *.C files, together with a Makefile and a sample output. The files
are needed to solve the project.
A project sample solution is now available on
remus at
~www/Public/cs314/f2001/projs/C++/solution
- Submission
Please submit the following three files using handin as
described above: Appointments.h, Appointments.C, and Iterators.C.
DO NOT submit or modify any other files .
It is YOUR responsibility to make sure that the files have been correctly
submitted:
handin cs314-{myinstructor}.proj3 Appointments.h Appointments.C Iterators.C
- Project clarifications (November 13, 10:00am)
- In the distributed version of file Appointments.C, the
class qualifier "AppointmentBook::" was missing for method
GetAppointment. This has been fixed in the current
version.
- This is a follow-up to the comments on the
Print() method in AppointmentBook . In
addition what is said below, you also should not implement
the method using ListAllAppointments .
- Project clarifications (November 12, 2:00pm)
- The SampleMain.output file contained a spelling error
("Critial" instead of "Critical"). This has been fixed in the
current version.
- You can assume that your program is tested with only valid
inputs, e.g., correct dates (not January 32) and correct date ranges
for ListAppointmentsInRange . In other words, your
code does not have to be robust on invalid inputs.
- This is related to the robustness issue. A program now aborts if
you try to create an invalid Date or invalid TimeSlot
object. This may help you while debugging your code. Use the current
version of the DateTime.C file if you want this added feature.
- Print() method in AppointmentBook . It is up
to you what format you want to use here. This routine is
really meant for you to be able to look at the content of an
AppointmentBook object. DO NOT
use this Print method to implement
ListAllAppointments . You should use an iterator here.
-
Scheme
Assignment (80 points)
-
Dec. 16th, 2001: Scheme grade has been emailed to you. Here is a link to the testing suite and grading policies.
Distributed: November 16, 2001/ finalized 11/18/01
Due: Sunday, December 9, 2001
-
Solution
- December 9:
Some students report strange dependencies between their matchList and
matchList3 functions: the running of one messes up the execution of
the other. Deal with this by loading your file,
running test**b** on matchList and (exit)
ing scheme; then restarting scheme, loading your file, and running
test**d2** on matchList3.
- December 5:
Instruction for submitting your project.
- Save all your work in one file called proj4.scm and submit
this file using handin:
handIn cs314-{myInstructor}.proj4 proj4.scm
- It does not matter whether you include in the file the functions
we provided in the description of the assignment (isVar?,map1,...). We
will load these functions *after* loading your file, which will
over-write whatever you had provided.
- Make sure the "helper functions" you wrote, if any, are included
in the *one* file you hand in.
- We will only examine the implementation of matchList and
MatchList3 for use of the higher-order functions that
we provided. You will get partial
credit even if you do not use these functions, but the more/better you
use them, the higher the grade. Note that you can define and use any other
higher order functions as helpers for any parts, BUT we will probably
not be able to detect this use of "higher order", so you will not get
credit for it.
- Aside: test data for matchList4 has been modified to make sure
that both arguments are lists. In fact, we made life easier by
ensuring here that both argument lists (pattern and value) have the
same lengths.
- November 30:
1.Revised test file
: some test runs were converted to comments (so
you read less); internal names changed and other comments added (so you
understand better).
2. FAQ
- Except in part (e) (which will not count for much), the first
argument of matchLists will be a List of AtomicPatterns; hence 'nested
patterns' like ((1 <>) (3)) will *NOT* (we repeat: *NOT*) appear,
except in part (e).
On the other hand, the second argument of matchList will be an arbitrary
Scheme list, but only with integer atoms. Please see the test data -- if you do not see a
situation being tested, please ask us: it is probably not needed.
- In parts d, and e we have left out the specification of matchAtomic3
and matchAtomic4, so you have some freedom. Please see the test data
file for comments.
- You may use any built-in Scheme functions. However, *IF* you are
using the built in function map, or reduce or accum (which are not in
scm, but which were discussed in class), please use instead the
functions map1, map2, accumUs or reduceUs that we described. [They do
the same thing, but we may modify them for grading purposes.]
- November 25: Draft of an extensive
test file. (Updated November 30.)
. Should help you figure out what each function needs to do.
(If you insist on printing it, please use mpage -2 -P[printerName]
- On-line documentation:
- Mini-tutorial and "how to run
scheme"
- Some files with interesting scheme programs are
len-app-atom-new.scm here
and
higher-order.scm
Back to the entire
class home page.
Last updated by BGR 6:42pm November 11, 2001.