File ChangingSymbols.html    Author McKeeman    Copyright © 2007    index

Changing the xcom Symbol Table

Preliminaries

Read the general description of the symbol table.

In MATLAB, in the xcom directory, type

  >> help Symbols.m
and
  >> xcom -symTrace -symDump -noExecute x:=1+r2i(y)

Responding to Changes in the CFG

Changing the X CFG means changing the opportunities to infer type and use information. A new rule means a new node which in turn requires modification of the Symbol.m tree walker.

Adding a Scalar Type to X

Each scalar type has a position in a bit-vector of types. If the bit-vector is all 1's, all types are possible which is the same as saying nothing is yet known. A new type needs a new bit position in the bit-vector. See variables intType and realType for a model.

Adding a Data Structure to X

There are three scalar types. Suppose vectors of all three are needed. In the strong-type world of X, the appearance of a subscripted variable is sufficient to determine that all uses of that variable are in fact array references. A single new bit in the symbol table will suffice, say vecType. The six type possibilities are then

logical logical vector
integer integer vector
real real vector

If subscripts are added the language, then one probably also wants to add a type inference that the subscript expression is of type integer.