Previous: , Up: Symbol Table   [Contents][Index]


C.2 Symbol Types

The symbol type describes the context in which a symbol may be used, and the attributes it supports. Generally, both the compiler and linker must be aware of a given symbol type: the compiler uses the symbol type to determine the type of code to generate, and the linker uses that information to determine what section the object code should be linked to. There are exceptions, noted in their individual sections.

TAME aims to reduce the number of symbol types in favor of a generalized system with few primitives—before defining a new symbol type, consider whether the existing can be reused in a novel way. Certain symbols will be consolidated in the future, time permitting.13

rate

Calculation.14 Calculations yield a single scalar value. If a child cgen exists, the yield of the calculation is equivalent to the sum of all its elements.

gen

Generator.15 Generators produce a vector element for each iteration of some calculation. Generators always have a parent rate symbol.

class

Classification. Classifications are universal or existential quantifiers most often used as predicates.

cgen

Classification generator.16 Analogous to gen, produces a boolean element for each classification result. Unlike gen, the dimension of a given cgen is the largest of all of its predicates.

param

Global parameter. All TAME programs can be viewed as a function operating on a set of global inputs. Their domains are defined by their datatype, represented by the symbol attribute dtype (see Symbol Types).

lparam

Local parameter. In contrast to param, local parameters are restricted to a defined scope (e.g. function parameters; let expressions). This symbol is not used by the linker.

lparent

Local parameter parent. This is set for let expressions in place of @parent since the parent let does not actually generate a symbol.

const

Global constant. Constant values (of any dimension). These values may be inlined at the compiler’s discretion.

tpl

Template definition. Templates define expandable text in the form of macros (see Macro Expansion). This symbol is not used by the linker.

type

Datatype. A type describes the domain of a symbol. Types do not include dimension information—such is determined by the dim symbol attribute (see Symbol Format).

func

Function. TAME supports functions as a means of calculation reuse and abstraction. Unlike calculations, functions can recurse (see allow-circular in Symbol Format). Functions are not first-class—TAME is not a functional language.

meta

Arbitrary metadata about the program. These metadata are key-value and are intended to be compiled statically into the program for static reference without having to actually invoke the program.


Footnotes

(13)

class can be a special case of rate. gen can acquire the multidimensional capabilities of cgen and the latter can be removed. param and lparam can be merged if the former is defined by a wide "local" scope. const is a special case of rate or cgen. func can be eliminated if all current rate are considered to be immediate function applications; this would also allow for mocking inputs for testing and debugging. If it’s not yet clear, TAME started as a very rigid, narrowly-focused system and began generalizing over time.

(14)

The term rate (a verb) is a consequence of TAME’s origin as an insurance rating system. This symbol type will be renamed to calc eventually.

(15)

The name is regrettable—it originated from the concept of a generator function, but never turned out that way. gen is actually a list comprehension, and will likely be renamed in the future to reflect that.

(16)

See footnote for gen.


Previous: , Up: Symbol Table   [Contents][Index]