Home  |   Notes  |   Languages  |   Programs  |   Homework
Program Assignment 1

75 Points
Due: 9/18/00 at 5:00PM

 Problem: Simple String Manipulation Language

In this programming assignment, you will implement an interpreter for SIMPLE, a simple string manipulation language. The syntax and semantics of SIMPLE are detailed in the SIMPLE language definition, which you should study carefully.

 Implementation Language

For this assignment, your program must be written in Pascal.

Your solution may only use standard Pascal code, not extensions or special library routines provided with your compiler.  Your program must adhere to proper use of the Pascal language as well as good programming style, including embedded routines, scoping, parameter passing, identifier naming, routine length, etc.

You must implement a lexical analyzer (tokenizer) for your interpreter. One Pascal subprogram should be clearly identified as the entry point to the lexical analyzer.

You must implement a symbol table and dynamic memory allocation for strings. Any dynamically allocated memory that is no longer usable must be returned to free memory. It is likely that you will use some global variables to implement these components. Use them sparingly.

 Input Format

Input to your program will be a SIMPLE program passed through standard input. You may assume that every input line is no longer than 80 characters; that is, your interpreter does not have to check for lines that are too long.

 Output Format

The output of your interpreter goes to standard output, as described in the SIMPLE language definition.

 Testing Your Program

Before submitting your interpreter, you must test it thoroughly. To do this, you should devise a set of tests of your own that you believe exhaustively test your interpreter's logic.

The GTA has devised a set of tests and has posted a sample of those tests here, along with the expected output. The remaining tests will be held back for grading purposes. Please be certain that your interpreter passes at least the posted test before submitting it.

 Submitting Your Program

Your Pascal program must be in a single file named <pid>.pp, where <pid> must be replaced by your Virginia Tech PID. That file and any auxiliary files, such as test results, must be packaged as a zip file (or tar file) named <pid>_project1.zip, which is attached to email sent to the class account, cs3304@courses.cs.vt.edu. The subject of the mail must be "Program assignment 1" - without quotes.

For example, the GTA's submission will be a Pascal file: derao.pp along with the input file containing the test cases and their output, packaged in a zip file: derao_project1.zip. Further, derao_project1.zip will be mailed to cs3304@courses.cs.vt.edu with subject Program assignment 1.

Your Pascal implementation is to be organized in a single file. The comments at the beginning of the file should identify the assignment and should give your name. Every Pascal procedure/function should be preceded by comments explaining its purpose, calling sequence, and implementation.

Be sure to follow the Program Submission Guidelines in preparing your report to turn in. In accordance with these guidelines, you will need to develop a set of test cases for your program that tests both positive and negative cases. For test cases that you are unable to run, be sure to indicate "Unable to perform test" in the corresponding test result within your report.

In gathering information for your report, you may find it useful to place all of these test cases in a single input file that you can feed to your program through I/O redirection. You can then capture the results of your tests while running under a command prompt (Windows or UNIX) for inclusion in your program report.

NOTE: Failure to follow submission guidelines can result in penalty.


Home  |   Notes  |   Languages  |   Programs  |   Homework
copyright © 2000 Virginia Tech, ALL RIGHTS RESERVED
Last modified: October 25, 2000, 08:11:42 EDT, by Lenwood S. Heath <heath@cs.vt.edu>