Texas Instruments TI89 Developer Guide - Page 203
Expressions and the Expression Stack, Overview, Contiguous Tokenized Polish Representation
![]() |
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 203 highlights
161 15. 15.1. 15.2. Expressions and the Expression Stack This chapter explains the internal data structures used to represent expressions and how the expression stack (estack) is used to do numeric and symbolic operations. Overview The AMS Operating System (OS) evaluates both numeric and symbolic expressions. Expressions are represented in a tagged internal representation called tokenized form. The tokenized form explicitly represents the hierarchical ordering of operations and their operands. The system provides a tokenizer that uses a lexical scanner and a parser to translate text strings into tokenized form. Tags are used to delimit each element of this form. Numbers, variables, operations, and functions all have associated tag values that identify them. However, some symbols that appear in the text representation do not appear in the tokenized form. For example, delimiters such as commas, parentheses, braces, and brackets are implied by the structure of the tokenized form. The system also provides a simplifier, which performs evaluation and simplification. The simplifier attempts to reduce an expression to its simplest form. It calls upon a variety of subsystems to perform the operations that are specified by the expression. The work of the tokenizer and simplifier are performed primarily on a stack structure called the expression stack. Finally, the system provides a detokenizer. As the name implies, the detokenizer translates the tokenized form of an expression into the corresponding text string. The system also provides the means to convert the tokenized form into a pretty printed form that can be displayed. Contiguous Tokenized Polish Representation The tokenizer produces a form called contiguous tokenized Polish representation. In this representation an expression occupies one contiguous block of memory allocated as an array of Quantums. A Quantum is defined in the system by the C declaration: typedef unsigned char Quantum; TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001
![](/manual_guide/products/texas-instruments-ti89-developer-guide-95b636f/203.png)