Assignments for CSC 424, Programming Languages

Wednesday, February 4:
Be prepared to discuss the following problems from Chapter 1 (pages 34-35): 2, 3, 4, 6, 7, 8, 12, 14, 15, and 18
Friday, February 6:
Present a 3-5 minute summary of a language or group of languages from Chapter 2:
Monday, February 9:
Turn in your partner's name and a list of preferred languages for the Language of the Week; read first few sections of Chapter 3; finish presentations:
Monday, February 16:
Chapter 3, Problems 2c, 3, 6b, 7b, 10, 11, 13, and 17 (there is a typo in 17: the rules should read "S -> A { b A }" and "A -> a [ b ] A")
Monday, February 23:
Turn in an extension to the grammar of SimpLan, as described in class; may be done with a partner, if you are going to work with them on the follow-on implementation project (TBA)
Wednesday, March 10:
Complete your extension to SimpLan--modify a copy of I:\CSC424\public\SimpLan2\ in your own folder on the I: drive (or in a shared workshop folder if you are working with a partner). Turn in a print-out of the files you modified, plus a collection of SimpLan programs that test your new feature.
Monday, March 29:
Icon assignment: write a program in Icon that receives a string from the user and prints the string to the screen if it's a palindrome but simply ends the program if not.
Monday, April 5:
Forth assignment: Indiana is considering a new toll system for its highways. The toll for each road is determined by calculating $0.25 times the square of the number of wheels the vehicle has. Write a set of Forth words that calculates a toll table for every vehicle that may use the roads, assuming that the largest truck has a maximum of 16 wheels, and motorcycles have only 2. You should note that no legal vehicle in Indiana has an odd number of wheels. Output should look like the following:
Wheels - cost
2 - 1
4 - 4
...
Note: Since we did not learn about support for floating point numbers in Forth, either do the calculation in cents (so the first cost above would be 100, etc.) or calculate the cost by dividing by 4 instead of multiplying by 0.25.
Friday, April 9:
Homework to turn in:
Monday, April 12:
JavaScript assignment: Create an HTML document that contains JavaScript code to handle a button click. When it executes, it should create an object (you may fill in whatever members you like), then use a loop to display a list of all of the members of the object (with document.write -- this may only work in Internet Explorer).
Monday, April 19:
Ada assignment: Create a package called Volume. The package should have a function which takes the lengths of the sides of a rectangular prism and calculates the volume (side1 * side2 * side3). Optionally, the package should also have a procedure to assign the length of the longest side to a variable (also passed as an argument). Within the main program, ask the user for the three values and output the volume (and optionally the longest side) to the screen.
Monday, April 26:
Smalltalk assignment: Here is a new definition of startAnimation:
startAnimation
    path := OrderedCollection new.
    p := 0@0.
    self move: 10 stepsBy: 0@10.
    self startStepping.
This function should do the same thing as the original (except for bouncing the ball back, since there is no reverse of the path here). Add code to complete this by writing the move: stepsBy: function, then add a few more lines to startAnimation to make your object move in a square. Hint: you may also have to change the class definition to get this to work. If you have any questions, feel free to direct them to Kyle, Matt, or Andrew.
Friday, April 30:
Homework to turn in:
Monday, May 3:
Erlang assignment: Copy the files ubercalc[framework].erl and ioserver.erl from the folder I:\CSC424\workshop\Erlang into the Erlang folder of your installation (this will be C:\Program Files\erl5.3 if you did a default install); change the name of the first file to ubercalc.erl. Add code to the server/1 function in the ubercalc module such that when the server receives a message of the form {'+',A,B}, it will add the numbers A and B and send a message containing the result to the I/O process. It should also be able to handle multiplication, division, subtraction, and modulus in the same way. Your project will also need to have a stop clause on the receive loop, so that the calculator can be turned off when you're done using it. When finished, the project will be run from the Erlang command prompt:
c(ubercalc).                % compile ubercalc.erl
c(ioserver).                % compile ioserver.erl
ioserver:start(io).         % start an instance of ioserver, named io
ubercalc:start(calc, io).   % start an instance of ubercalc, named calc
calc ! {'+', 12, 34}.       % should cause 45 to be printed
...
calc ! stop.                % stop the calculator server
Monday, May 10:
Scheme assignment: Write a function that computes the sum of the factorials of the numbers in a list. Use a separate recursive function to compute factorials.
Wednesday, May 19, 5 pm:
Take-home final

Languages of the Week:

March 17 Icon Brolsma & Hammes
March 31 Forth Betz & Whitaker
April 7 JavaScript Moore & Pease
April 14 Ada Harris & Tannenholz
April 21 Smalltalk Shipley, Stone & Thomas
April 28 Erlang Colvard & Haas
May 5 Lisp (Scheme) Bryan & Vlahov
May 12 Prolog Grossnickle & Macleod