Download GEZEL User Manual

Transcript
April 21, 2005 10:39 am
N
symboltable
1
symbol
asym
symboltype
context
namesym
pinsym
refsym
FIGURE B.3. Class diagram of the symbol table hierarchy.
bol varies according to the kind of symbol. For example, the symbol information of a constant integer is different than that of an addition operator symbol.
Consider the following GEZEL program snippet, a two-instruction datapath.
dp updown(out a : ns(3)) {
reg c : ns(7);
sfg up { c = c + 1; a = c; }
sfg dn { c = c - 1; a = c; }
}
The symbol table that is created for this datapath is shown in the next table.
Id
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Symbol
Type
namesym
namesym
sigtypesym
namesym
sigtypesym
namesym
namesym
binaryopsym
binaryopsym
binaryopsyn
namesym
namesym
binaryopsym
binaryopsym
binaryopsym
Symbol
kind
datapath
dpoutput
sigtype
reg
sigtype
sfg
const_op
add_op
assign_op
assign_op
sfg
const_op
sub_op
assign_op
assign_op
Contents
context
updown
a
3-bit unsigned
c
7-bit unsigned
up
"1"
(L=3, R=6)
(L=3, R=7)
(L=1, R=3)
dn
"1"
(L=3, R=11)
(L=3, R=12)
(L=1, R=3)
-1
0
1
0
3
0
5
5
5
5
0
10
10
10
10
The table shows three different symbol types (namesym, sigtypesym, binaryopsym).
Each symbol type can be one of multiple kinds. For example, a datapath name and a datapath input are both characterized by a string. They have the same symbol type namesym,
but they are symbols of different kinds (datapath and dpoutput). GEZEL has 16 symbol
types and 66 different symbol kinds. Each symbol has a unique identifier and a context. A
Schaumont, Ching
GEZEL User Manual
112