

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


1
Your assignment for Homework 2 is to implement a stack to parse simplified XML input and verify that the input consitutes well formed XML. This is quite similar to parsing an algebraic expression to ensure that the open and closing parentheses have been done correctly. Indeed, many algebraic expressions are written with three different opening and closing characters: parentheses ( and ), “square brackets” [ and ], and “curly braces” { and }. XML just allows a user to generate an essentially infinite variety of opening and closing tokens as
public interface IStack { /*********************************************************************
The actual Stack class can use your DLL from Homework 1. By doing this,
2
the push method can simply use the existing addFirst method to push a node onto the stack, and the pop method can simply return the head node of the DLL. (Remember to unlink the head node as well.) Creating a stack is thus the easy part of this program; the hard part of the program is to use the stack to verify correctness of the input file.