88 |
and var = V of { |
and var = V of { |
89 |
name : string, (* name *) |
name : string, (* name *) |
90 |
id : Stamp.stamp, (* unique ID *) |
id : Stamp.stamp, (* unique ID *) |
91 |
|
bind : var_bind ref, (* binding *) |
92 |
useCnt : int ref, (* count of uses *) |
useCnt : int ref, (* count of uses *) |
93 |
props : PropList.holder |
props : PropList.holder |
94 |
} |
} |
95 |
|
|
96 |
|
and var_bind |
97 |
|
= VB_NONE |
98 |
|
| VB_RHS of rhs |
99 |
|
| VB_STATE_VAR |
100 |
|
|
101 |
withtype assign = (var * rhs) |
withtype assign = (var * rhs) |
102 |
|
|
103 |
datatype program = Program of { |
datatype program = Program of { |
195 |
structure Var : sig |
structure Var : sig |
196 |
val new : string -> var |
val new : string -> var |
197 |
val name : var -> string |
val name : var -> string |
198 |
|
val binding : var -> var_bind |
199 |
|
val setBinding : var * var_bind -> unit |
200 |
val same : var * var -> bool |
val same : var * var -> bool |
201 |
val compare : var * var -> order |
val compare : var * var -> order |
202 |
val hash : var -> word |
val hash : var -> word |
306 |
|
|
307 |
and var = V of { |
and var = V of { |
308 |
name : string, (* name *) |
name : string, (* name *) |
309 |
|
bind : var_bind ref, (* binding *) |
310 |
id : Stamp.stamp, (* unique ID *) |
id : Stamp.stamp, (* unique ID *) |
311 |
useCnt : int ref, (* count of uses *) |
useCnt : int ref, (* count of uses *) |
312 |
props : PropList.holder |
props : PropList.holder |
313 |
} |
} |
314 |
|
|
315 |
|
and var_bind |
316 |
|
= VB_NONE |
317 |
|
| VB_RHS of rhs |
318 |
|
| VB_STATE_VAR |
319 |
|
|
320 |
withtype assign = (var * rhs) |
withtype assign = (var * rhs) |
321 |
|
|
322 |
datatype program = Program of { |
datatype program = Program of { |
528 |
fun new name = V{ |
fun new name = V{ |
529 |
name = name, |
name = name, |
530 |
id = Stamp.new(), |
id = Stamp.new(), |
531 |
|
bind = ref VB_NONE, |
532 |
useCnt = ref 0, |
useCnt = ref 0, |
533 |
props = PropList.newHolder() |
props = PropList.newHolder() |
534 |
} |
} |
535 |
fun name (V{name, ...}) = name |
fun name (V{name, ...}) = name |
536 |
|
fun binding (V{bind, ...}) = !bind |
537 |
|
fun setBinding (V{bind, ...}, vb) = bind := vb |
538 |
fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b) |
fun same (V{id=a, ...}, V{id=b, ...}) = Stamp.same(a, b) |
539 |
fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b) |
fun compare (V{id=a, ...}, V{id=b, ...}) = Stamp.compare(a, b) |
540 |
fun hash (V{id, ...}) = Stamp.hash id |
fun hash (V{id, ...}) = Stamp.hash id |