Popis: |
Generators, or expressions capable of producing a sequence of results during evaluation, are found in one form or another in a number of programming languages. The use of generators has been limited by a lack of understanding of their operation. Control structures for generating expressions are usually patterned after the control structures found in conventional language designs. A notation for describing the static aspects of generators is presented in this dissertation. This notation is used to describe the operation of the generator-based control structures in Icon and to introduce several novel control structures based upon generator evaluation. Co-expressions are introduced as the expression-level equivalent of coroutines, and combined with generators to provide a powerful programming facility. Finally, machine and language independent models for implementation of goal-directed evaluation and co-expressions are presented. |