Next: , Previous: Imperative Language Syntax, Up: Imperative Language Interpreter


4.3 Variables Collections

Interpreted programs may access some of the state of the application via variables, if application so desires.

The flexible context / lookup method specification was decided against, and for now the way to introduce the programs with variables is via variables collections. If ever more flexibles ways for introducing variables will be allowed, the current, variables collection one will still be supported and default.

Variables collections are application wise typeless. They are declared as pointers (to void presumably) and initialized with NULL. A single collection is allowed for program parsing, and it is linked into the parsing context (the struct x1f4_c1_type one) via variable_set.context field of the parsing context.

See struct x1f4_c1_type.

Adding variables to variables collections is convenienced by the x1f4_push_mode, x1f4_push_real, x1f4_push_text and x1f4_push_variable functions.

See x1f4_push_mode.

See x1f4_push_real.

See x1f4_push_text.

See x1f4_push_variable.

Variables collections may be examined via the x1f4_list_state function.

See x1f4_list_state.

Once variables collections are no longer of use they are to be disposed via the x1f4_air_state function. Executable program representations do refer variables in the variables collection in use during the construction of such representations, hence disposing of variables collections should not occur before the disposal of the executable program representations referring them.

See x1f4_air_state.