Computer Science 210
Data Structures

Fall 2016, Siena College

Lab 8: P.S.: It's Just a Stack
Due: 10:00 AM, Wednesday, November 8, 2016

Your lab programming assignment this week is described in Section 10.5 of Bailey. You will learn about the PostScript language, and gain experience using stacks and making use of an existing partial implementation.

You may work alone or in a group of 2 or 3 for this assignment.

Getting Set Up

Create a document where you will record your answers to the lab questions. If you use plain text, call it "lab8.txt". If it's a Word document, you can call it whatever you'd like, but when you submit, be sure you convert it to a PDF document "lab8.pdf" before you submit it.

Programming Assignment

Your task is to write the PostScript interpreter program in Section 10.5 of Bailey. This will be graded as a programming assignment, so be sure to refresh your memory about the submission guidelines.

Initial Steps

Before you begin, download and extract the starter files from the email you should have received. Familiarize yourself with the three given classes and make sure you understand how they work, especially how you would use them. Also, carefully read the lab description in the text and this handout. You are certain to have questions, but you should be able to get far enough along in planning and implementation during our lab meeting to have many of those questions addressed.

Your task is to develop the Interpreter class. Start by developing a sketch of this class. Interpreter is where you will process the tokens being delivered to your interpreter by the provided Iterator class. You are strongly encouraged to discuss your sketch of this class with your instructor during lab or by email for comment and discussion before you begin significant implementation.

Notes and Guidelines

In addition to everything in the Bailey lab description, keep the following in mind while completing your program.

Bonus Opportunity

For 5 bonus points, you can implement procedures as described in thought question 3. If you design everything else properly, this should be almost a trivial extension.

For another 5 bonus points, you can implement the if operator as described in thought question 4.

Related Questions

Note: one word or one sentence answers are not sufficient here for full credit. Please be thorough and justify your answers.

Question 1: Answer thought question 1 from Bailey p. 249. (3 points)

Question 2: Answer thought question 2 from Bailey p. 249. (4 points)

Question 3: Answer thought question 5 from Bailey p. 250. Note: while you don't have to do questions 3 and 4, you need to read and understand them to be able to do 5. (5 points)


Before 10:00 AM, Wednesday, November 8, 2016, submit your lab for grading. There are two things to do to complete the submission: (i) Copy your file with the answers to the lab questions into your project directory. Be sure to use the correct file name. If you prepared your answers in Word, export to a PDF file and submit that. and (ii) upload a copy of your lab (a .7z or .zip file containing your project directory) to Blackboard under "Lab8". Don't forget to check your programming assignment programs for compliance with the Style Guide for CSIS 210 Programs


This assignment is worth 60 points, which are distributed as follows:

> FeatureValueScore
Interpreter program design and style 8
Interpreter program documentation 10
Interpreter correctness 30
Question 1 (Thought Question 1) 3
Question 2 (Thought Question 2) 4
Question 3 (Thought Question 5) 5
Bonus opportunity 1: procedure support (5)
Bonus opportunity 2: if support (5)
Total 60

The program design grade will be based on the design choices you make in the implementation of the Interpreter class. The program style grade will be based on code formatting and approriate use of Java naming conventions. The program documentation grade is, of course, based on the comments you provide. The program correctness grade is based on how well your program meets the functionality requirements.