Augmenting text-based programming with rich structured interactions has been explored in many ways. Among these, projectional editors offer an enticing combination of structure editing and domain-specific program visualization. Yet such tools are typically bespoke and expensive to produce, leaving them inaccessible to many DSL and application designers. We describe a relatively inexpensive way to build rich projectional editors for a large class of DSLs -- namely, those defined using JSON. Given any such JSON-based DSL, we derive a projectional editor through (i) a language-agnostic mapping from JSON Schemas to structure-editor GUIs and (ii) an API for application designers to implement custom views for the domain-specific types described in a schema. We implement these ideas in a prototype, Prong, which we illustrate with several examples including the Vega and Vega-Lite data visualization DSLs.
翻译:通过丰富的结构化交互来增强基于文本的编程已在许多方面得到探索。其中,项目式编辑器提供了结构编辑与领域特定程序可视化相结合的有吸引力的方案。然而,此类工具通常是定制化且开发成本高昂,导致许多领域特定语言和应用程序设计师无法使用。我们描述了一种相对经济的方式,为一大类领域特定语言(即使用JSON定义的语言)构建丰富的项目式编辑器。给定任意此类基于JSON的领域特定语言,我们通过以下方式推导出一个项目式编辑器:(i) 从JSON模式到结构编辑器图形界面的语言无关映射,以及(ii) 为应用程序设计师提供的应用程序编程接口,用于实现模式中描述的领域特定类型的自定义视图。我们在原型系统Prong中实现了这些想法,并通过包括Vega和Vega-Lite数据可视化领域特定语言在内的多个示例进行了说明。