CS 433 - Homework 1 - 2/13/08

Symbol table implementation

Due: Monday, 2/18/08, at 2pm

Implement a symbol table using a hashtable of dynamically allocated records as discussed in class. To do this, copy my directory ~schar/cs433/hw1 and complete the file symtab.c. Here's how to get started:
    ~> mkdir cs433                              creates new directory 
    ~> chmod go-rwx cs433                       makes it non-readable for others 
    ~> cd cs433
    ~/cs433> cp -r ~schar/cs433/hw1 .           copies my directory to current dir (".") 
    ~/cs433> cd hw1
    ~/cs433/hw1> ls
    Makefile  main.c    symtab.c  symtab.h  test.txt
    ~/cs433/hw1> make depend                    see Makefile for explanation 
    ~/cs433/hw1> make                           creates executable symtab_test 
           [ some warning messages ]
    
    ~/cs433/hw1> ./symtab_test 
    
      usage: symtab_test sourcefile
    
    ~/cs433/hw1> more test.txt
    HDR = symtab.h
    SRC = main.c symtab.c
    OBJ = main.o symtab.o
    
    ~/cs433/hw1> ./symtab_test test.txt
    previously seen:   HDR
    previously seen:   symtab
    previously seen:   h
    previously seen:   SRC
    previously seen:   main
    previously seen:   c
    previously seen:   symtab
    previously seen:   c
    previously seen:   OBJ
    previously seen:   main
    previously seen:   o
    previously seen:   symtab
    previously seen:   o
Once you have completed the program, the output should look like this:
    insert:   HDR
    insert:   symtab
    insert:   h
    insert:   SRC
    insert:   main
    insert:   c
    previously seen:   symtab
    previously seen:   c
    insert:   OBJ
    previously seen:   main
    insert:   o
    previously seen:   symtab
    previously seen:   o

What to hand in

Hand in a printout of your completed file symtab.c. Use the "pretty-print" function from XEmacs for printing. Please note on your printout how much time it took you. Make sure that you add your name as a comment at the top, and that you comment the code you write well. One of the goals of this course is to increase your software engineering skills, and I will place a lot of emphasis on proper coding style when grading.

Thorough testing is also essential, and I ask that you hand in a printout of sample output produced by your program, when run on a small text file that you created. That is, don't just run it on test.txt, but also on a more challenging file containing different words that result in identical hashcodes!