CISC220, Summer 2006, Project 5

Introduction

This project is a continuation of Project 4 on HTML Tag Matching

As we discussed in lecture, you can use a stack to solve the problem of checking open and close tags in HTML for "proper nesting". Open tags are pushed onto the stack. Close tags cause us to pop the top of the stack, and check for a match. If the close tag and the top of the stack doesn't match, or if the stack has nothing to be popped we return a failure. We also return a failure if the stack is not empty when we hit end of file.

In Project 4, you did test-driven development of two classes:

In Project 5, you use these classes to solve the problem

Project 5 will use the classes you developed to write a program that accepts HTML input, and either prints "ok", or gives a report of one of three kinds of errors that may be encountered:

  1. A mismatch between a close tag and the open tag at the top of the stack
  2. A close tag, encountered when the stack is empty (i.e. there is no open tag to match this close tag with)
  3. An open tag with no close tag (encountered when we reach end of file with a non-empty stack)

More about what you will do in Project 5

I am providing you with two files:

Those files can be found at:

These represent the interface to an HTMLTagMatcher_C class (similar to the Tokenizer_C class we covered in lecture... see the lecture notes and code from 07.24,07.25,07.26 and 07.27)

What to do

  1. add tests to HTMLTagMatcherTest.cc so that it tests several cases ALL three errors, plus several "good" HTML files

  2. write the .cc files for HTMLTagMatcher_C (at first, you should just write stubs, so that the tests fail). Here is where you might need to add code to the private part of HTMLTagMatcher.h to add private member functions, data members, etc. But don't change the interface to HTMLTagMatcher_C (i.e the public part).
  3. write a Makefile to compile and link the project, and run your tests
  4. now fix the HTMLTagMatcher.cc file so that it passes all the tests
  5. write a separate main program in a file matchTags.cc that will take a filename on the command line, open it, and actually parse the HTML in that file (you can use the tokenize.cc program from the lecture notes of 07.24,07.25,07.26 and 07.27 as a model.) Include error checking for your command line parameters, opening the file, etc.
  6. write four HTML files, input1.html, input2.html, input3.html and input4.html, that illustrate all four behaviors of your class, i.e.
    1. input1.html shows error 1 (mismatched tags)
    2. input2.html shows error 2 (close tag with no open tag)
    3. input3.html shows error 3 (open tag with no close tag)
    4. input4.html parses ok
  7. make a script that lists all your code, all your .html sample input files, and your Makefile, then shows a clean compile (make clean, make all), and shows the output of running your tests, and running your matchTags program on all four sample .html files.

Special Notes

Pair Programming

Pair Programming is an option for this assignment. It is not required---you are free to work alone if you prefer.

See the comments on the Wiki page: http://jaguar.cis.udel.edu:8051/220wiki/Wiki.jsp?page=06J.Proj5 for information about doing Pair Programming on this project.

What you can change, and what you should not change

Grading:

  1. add tests to HTMLTagMatcherTest.cc (20%)

  2. write the .cc files for HTMLTagMatcher_C (20%)

  3. write a Makefile to compile and link the project, and run your tests (10%)
  4. now fix the HTMLTagMatcher.cc file so that it passes all the tests (points included in part 2 above)
  5. write a separate main program in a file matchTags.cc (10%---also see item 6)
  6. write four HTML files, input1.html, input2.html, input3.html and input4.html, that illustrate all four behaviors of your class (20%---5% each for .html file, and correctness of output of matchTags.cc for that file)
    1. input1.html shows error 1 (mismatched tags)
    2. input2.html shows error 2 (close tag with no open tag)
    3. input3.html shows error 3 (open tag with no close tag)
    4. input4.html parses ok
  7. make a script that lists all your code, all your .html sample input files, and your Makefile, then shows a clean compile (make clean, make all), and shows the output of running your tests, and running your matchTags program on all four sample .html files. (10% for correctness of script file)

Also, 10% for general correctness of submission, following directions, etc.

Total: 100%

End of file proj5.html, for Project 5, CISC220, 06J