Previous Up Next

3  Table

The module contains a generic lookup table, i.e., a dictionary or finite map for keys which can be converted into an integer value. It will be used with different types of keys at various places throughout the compiler. The table, as said, is generic.

untested, interface complete

In the implementation of [App98b], the functor IntMapTable (which in turn uses the IntBinaryMap library module) is used to implement the symbol table module, which is an instantiation of the functor with symbols taken for the keys. In our implementation, the symbol module is implemented independantly. Where is the functor used throughout?

Answer:
It is used in graph.sml, symbol.sml, temp.sml, and graph.sml, each one has a Table structure (partly internal).

An alternative imperative implementation could use the hashtables from the library instead. The problem with the imperative implementation is, that Ocaml does not allow polymorphic types at that place for reasons of type safety. An older version of the symbol tables used indeed an imperative implementation. The older version of the symbol tables is, it seems, kept in lib/ocaml.

 ,
Previous Up Next