Next: Symbol Types, Up: Symbol Table [Contents][Index]
A symbol is nothing more than an abstract representation of an
object,
represented by a preproc:sym
node in the symbol table
(see Symbol Table),
For some symbol \(\sigma\) describing some object \(\theta\), the
following attributes are recognized:
name
Unique identifier of \(\sigma\). Required.
type
Type of object described by \(\sigma\). Multiple symbols of different types may share the same \(\theta\). Required.
desc
Human-readable description of \(\theta\). Required.
dim
Dimensions of \(\theta\) as an integer. See _symtable:str-to-dim#1 for supported strings. Required
dtype
Reference to some symbol describing the datatype of \(\sigma\), if applicable.
tex
TeX code used to render \(\sigma\) in a math block.
parent
Reference to a symbol from which \(\sigma\) is derived.
For example, a cgen
symbol would have the associated
class
as its parent.
extern
Whether \(\sigma\) is unresolved in the given context.
missing
If extern, a human-readable message describing \(\theta\). This is useful to display to the user on error when \(\sigma\) is the result of generated code (e.g. template expansion).
no-deps
When true
,
linker does not attempt to look up dependencies for this symbol.
Otherwise,
as a safeguard against compilation bugs,
the linker will fail if a symbol is missing a dependency list.
allow-circular
Permit \(\sigma\) to be part of a cycle (see Dependency Graph). This is desirable for recursive functions, but should otherwise be avoided like the plague.
keep
Always link \(\sigma\), even if disjoint from the program’s dependency graph. This is marked for removal.11
An attribute not marked as required may be omitted. If an implementation wishes to attach additional metadata to a symbol, it must use a different namespace.
xmlns:_symtable="http://www.lovullo.com/tame/symtable/_priv"
Convert a string dimension representation into an integer.
Standard dimensions are ‘scalar’ (0), ‘vector’ (1), and ‘matrix’ (2). If no value is provided, then ‘scalar’ is assumed. All unknown strings will yield a value of ‘-1’.12
Definition:
<function name="_symtable:str-to-dim" as="xs:integer"> <param name="str" as="xs:string?" /> <choose> <when test="empty( $str ) or ( $str = 'scalar' )"> <sequence select="0" /> </when> <when test="$str = 'vector'"> <sequence select="1" /> </when> <when test="$str = 'matrix'"> <sequence select="2" /> </when> <otherwise> <sequence select="-1" /> </otherwise> </choose> </function>
“Keeps” cause various tricky and inelegant situations, cause unnecessary coupling of unrelated concerns, and create a performance nightmare for the linker. They were created as a kluge during a near-rewrite of TAME (which introduced the symbol table) to get around the fact that certain systems weren’t in place to pull in symbols as dependencies for certain operations; it wasn’t intended to stick. They will be removed entirely and will not be replaced with anything—if a symbol is to be linked, it must be part of the dependency graph.
That’s not to say that TAME can’t support an arbitrary number of dimensions; this syntax just doesn’t provide that utility.
Next: Symbol Types, Up: Symbol Table [Contents][Index]