A two-view document editor with user-definable document structure

Today's electronic document preparation systems divide into two major categories: WYSIWYG editors and batch-style document formatters. Users of the WYSIWYG editors value the ability to see the appearance of the page without printing it. Users of formatters value the expressiveness and programmability they provide. But many users really wish for the advantages of both. I propose that the best solution is to offer them both: a WYSIWYG view and a program-like view of the same document, side by side and tightly coupled. This is more difficult to design and implement than either kind of system by itself, because WYSIWYG editing becomes a matter of editing a program by editing its output. It requires a document description language and an editor that are carefully designed to work sensibly together, and a very fast incremental interpreter. This thesis describes a two-view document editor, Lilac, that demonstrates such a design and its practicality on today's workstation computers. Three major problems are addressed: language design, WYSIWYG editor design, and implementation for real-time performance. One of the most valued uses of programmability in document formatters is its ability to express the logical, hierarchical structure of documents and in doing so, to bind style to structure. In Lilac this is a fundamental theme of the design, and it helps solve the problem of making the language and the editor make sense together. User-defined functions serve as document structuring tools, and the hierarchy of nested function calls forms the basis for a hierarchically oriented WYSIWYG. The language faces the additional constraint that it support fast incremental reinterpretation. This need is met by making the language purely functional and by using dynamically scoped let statements to modify styling parameters. The editor faces the challenge of editing a hierarchy of arbitrary depth made of user-defined components. This need is met by providing quickly accessible means to select and to replicate structures at any level in the hierarchy. The implementation faces the challenge of reinterpreting a small part of the document and updating the screen accordingly, ten times per second. This is met by making the interpreter highly incremental, with many intermediate values stored from one cycle to the next.