ICPL Compiler Project
Phase 1
Lexical Analysis

Part 1 -- The lexical analysis module


A separately compiled module is to be prepared to perform lexical analysis on a source file.  This module will the only module in the compiler that will have direct access to the ICPL source code.  The interface to this module will contain

  1. A type definition for the lexical token types.
  2. A symbol table which will be an array of strings.
  3. An array of error messages.
  4. An initialization procedure that will open the ICPL source file and create any necessary data structures.
  5. A termination procedure that will close the ICPL source file and deallocate any opened data structures.
  6. A procedure GetToken that would return each time it is called the next token in the ICPL source file (as defined in part 1) and its value.
Token values are defined as following The lexical analysis module must be properly documented.
 
 
 

Part II -- The test program

The test program should be able to open a source ICPL file of the users choice and find by repeated calls to the GetToken procedure all of the tokens within that file.  It should print out to a file or display on the screen the following: The output of the test program should be readable to someone who has not read the code of the program.