next up previous
Next: Test Programs for ALLCOT (5 Up: The Assignment Previous: A parser for ALLCOT (15

Symbol Tables for ALLCOT (10 marks)

Enhance your parser such that it creates symbol tables. Again, please refer to the Assignment 3 of the year 2003-2004 together with the yacc.tar.gz archive.

To make things simple, one could avoid linked lists and use only records and arrays instead. You may have a look at the file mool-3.h in the yacc.tar.gz archive.

Alternatively, you can use data-structures provided by the glibc library.

At the end of the parsing, your parser should report on the contents of the symbol-tables. Here's an example using mool.y, mool.l, mool.h linked to mool-3.y, mool-3.l, mool-3.h.

[moreno@iguanodon yacc]$ make mool.out
...................................

[moreno@iguanodon yacc]$ ./bin/mool < test/p0.mool    
Parsing program ... 
   Parsing class Pair ...
   Class parsed.
Program parsed.
Class[0] is Pair
      Attribute 0 : i of type -1
      Attribute 1 : j of type -1


next up previous
Next: Test Programs for ALLCOT (5 Up: The Assignment Previous: A parser for ALLCOT (15
Marc Moreno Maza
2004-12-01