COMP 304B Object-Oriented Software Design -- Assignment 3\\\ Due date: Sunday March 23, 2003 before 23:55

COMP 304B Object-Oriented Software Design - Assignment 3
  Due date: Sunday March 23, 2003 before 23:55

 

[printable version of this document (pdf)]| [COMP 304B Home]


Practical information

Goal

In this assignment you will use UML State Machines to specify whether to accept or reject a series of input characters from an input character stream. The specification will be derived by you from a Regular Expression specification. The automaton will not only accept/reject input, but will also determine pertinent properties (such as value) of the recognized token. For the spreadsheet application, we need to be able to recognize Number and CellRef tokens. You will encodecode both automata in the given Python framework and run the simple provided tests.

Your assignment solution should contain:

  1. A state automaton completely specifying recognition of

    You may use any drawing tool to produce the automaton.

  2. An encoding, in the file scanner.py, of both patterns in the form of the classes NumberScanner and CellRefScanner, derived from the Scanner class given below.
  3. The results of the simple tests in tests.py.

Upload all files to WebCT and provide links to them from your index.html file.

Starting Point and Example

The Regular Expression [10]*0 is recognized by the automaton below.
EvenBinaryScanner.png

The scanner is encoded in the class EvenBinaryScanner in scanner_evenBinary.py. This requires an input stream class CharacterStream found in charstream.py. The test script test_evenBinary.py produces the following output when the __trace__ variable is set to False. It produces the following output when the __trace__ variable is set to True.


Translated from TEX by TTH, version 3.02 (minor customizations by HV). On 18 Mar 2003, 12:45.