Passive documents and active programs now widely comingle. Document languages include Turing-complete programming elements, and programming languages include sophisticated document notations. However, there are no formal foundations that model these languages. This matters because the interaction between document and program is complicated and can be error-prone. In this paper we describe several of these problems, then taxonomize these document languages, and model them as levels of a document calculus. We employ the calculus as a foundation for implementing complex runtime features such as reactivity, as well as for proving a few useful theorems regarding the boundary of content and computation. We intend for the document calculus to provide a theoretical basis for new document languages, and to enable designers to clean up the unsavory corners of existing ones.
翻译:被动文档与主动程序如今广泛融合。文档语言包含图灵完备的编程元素,而编程语言则包含复杂的文档标记。然而,目前缺乏对这些语言进行建模的形式化基础。这一问题的重要性在于,文档与程序之间的交互既复杂又容易出错。本文首先描述了若干此类问题,随后对文档语言进行分类,并将其建模为文档演算的不同层级。我们利用该演算作为基础,实现响应性等复杂运行时特性,并证明若干关于内容与计算边界的有用定理。我们期望文档演算能为新型文档语言提供理论基础,并使设计者能够清理现有文档语言中不完善的部分。