{T.type = record(top(tblptr));
T.width = top(offset);
pop(tblptr); pop(offset)}
T -> record LD end |
{ t = mktable(nil); |
|
push(t, tblptr); push(0, offset)
|
|
}
|
L -> |
{ T.type = record(top(tblptr));
|
|
T.width = top(offset);
|
|
pop(tblptr); pop(offset)
|
|
} |
The processing done corresponding to records is similar to that done for procedures. After the keyword record is seen the marker L creates a new symbol table. Pointer to this table and offset 0 are pushed on the respective stacks. The action for the declaration D -> id :T push the information about the field names on the table created. At the end the top of the offset stack contains the total width of the data objects within the record. This is stored in the attribute T.width. The constructor record is applied to the pointer to the symbol table to obtain T.type.