CS 119 Lab 9Abstract Data Type : Stack

Objectives

  • Create a representation for the ADT Stack
  • Perform the following tasks in the order given.

    1. Download the Lab9 project and import it into Eclipse as a Haskell project.
       
    2. Test out the examples for queues and make sure you understand how they work
       

    3.  
      Assignment:
      Write a module for the ADT Stack.  It should contain empty, isEmpty, top, push and pop operations.

       

    4. We can use a stack to check that a string has balanced parentheses. For example, "([]())" is balanced but "([)())" is not.  We can check for balance by marching through the characters and pushing a left paren onto a stack when encountered and popping a paren off the stack on a right paren of the matching type.
       
       
      Assignment:
      Import your stack module into another module which implements the function
      matchingParens :: String -> Bool


       

    5. Email your modified zipped project to me for grading.