JUCS - Journal of Universal Computer Science 14(21): 3414-3430, doi: 10.3217/jucs-014-21-3414
Beyond ASCII - Parsing Programs with Graphical Presentations
expand article infoMartijn M. Schrage, S. Doaitse Swierstra
‡ Utrecht University, Utrecht, Netherlands
Open Access
Proxima is a generic structure editor suitable for a wide range of structured document types. It allows edit operations on the document structure as well as on its screen representation (i.e. free-text editing), without the need to switch between the two modes. The system maintains a bidirectional mapping between the document structure and its presentation. Besides obvious applications, such as word-processor and spread-sheet editors, Proxima is especially well-suited for defining source editors for programming languages. Presentation-oriented edit operations require that an edited presentation can be parsed to yield an updated document structure. However, conventional parsing techniques cannot readily be applied, since presentations in Proxima are not restricted to text but may also contain graphical elements. For example, an exponential may be presented as 32. Although this graphical presentation may not be directly edited at the presentation level, its components may. Hence, instead of simply parsing the changed representation, we have to take into account the existing structure. This paper explains the scanning and parsing process for presentations that are a possibly nested combination of text and graphical elements. For textual parts of the presentation a Haskell combinator parser needs to be provided. The parser for graphical parts, on the other hand, is constructed by Proxima, based on information in the presentation. White space in the presentation can be handled automatically, if desired.
presentation-oriented editing, parsing, Haskell