Module Make.Symbol

Symbol Value Isomorphism.

A value can have a symbolic representation that is useful to embed analysis in the machine computation. We inject symbols, represented with the string data type, into the value, using interning, i.e., each symbol is mapped to its index (see the Index module).

The relation between values and symbols is not bijective, since not all values represent interned symbols, moreover it depends on the order of statements, i.e., a symbol shall be interned (with the to_value call) before it can be translated back into a symbolic representation.

Implementors of Primus components are encouraged to use the Index module and implement their own mapping with bijection enforced by the abstraction.

val to_value : string -> value Machine.t

to_value sym returns a value corresponding to the provided symbolic representation.

val of_value : value -> string Machine.t

of_value v returns a symbolic representation of the value v.

If the symbolic representation of a value wasn't established, then returns an empty string.