Interpretation process

Interpretation of documents proceeds in several steps:

  1. Evaluation expands the document tree , containing markup tags, to the object tree , containing only primitive constructs.
  2. Typesetting produce and position the boxes described by primitive constructs.
  3. Display draws the boxes to screen or to PostScriptŮ.

We previously noted that a tree label can either be the name of a typesetter primitive or the name of markup tag. Typesetter primitives are the fundamental building blocks of the typesetting languages. Markup tags can be though of as the functions and procedures of the typesetting language. Tree leaves are character strings.

Primitives and markup tags are collectively referred to as typesetter operators, or operators for short. Trees are expressions, tree labels are operators names and subtrees are operands. All expressions have a value and all values are trees. A trivial tree is only made of a string. In this respect, the typesetting language is similar to Scheme: values and expressions are both represented as trees, atomic values are strings.

However, an important difference with Scheme is that most trees cannot be deconstructed subtrees cannot be accessed, strings and tuples are the most notable exceptions.

Most operators are only meaningful either for evaluation or typesetting: computational operators only have a meaning for evaluation and are substituted before typesetting, physical operators only have a meaning for typesetting and are self-evaluating. Operands are evaluated in applicative order. The typesetting language does not use normal order lazy evaluation, but it provides mechanisms for partial and delayed evaluation.

Operators may not display all their subtrees. Most computational operators and many physical operators consume at least one of their operands. Trees which are not associated to typeset boxes are invisible and inaccessible. Conversely, boxes which are not associated to subtrees of the document tree are uneditable. Trees which are produced during evaluation are called synthetic trees and are uneditable. Understanding which operators produce editable values and how they affect the accessibility of their operands is essential to designing good typesetter macros.

What you should remember:

Now that you understand the basic rules of the language, we will describe its atomic data types and data storage mechanisms. Compound values are described in the chapter about typesetter primitives, along with the primitives used to create and operate on them.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".