Code Style Sheets: CSS for Code
Sam Cohen, Ravi Chugh
摘要
Program text is rendered using impoverished typographic styles. Beyond choice of fonts and syntax-highlighting colors, code editors and related tools utilize very few text decorations. These limited styles are, furthermore, applied in monolithic fashion, regardless of the programs and tasks at hand.
We present the notion of code style sheets for styling program text. Motivated by analogy to cascading style sheets (CSS) for styling HTML documents, code style sheets provide mechanisms for defining rules to select elements from an abstract syntax tree (AST) in order to style their corresponding visual representation. Technically, our selector language generalizes essential constructs from CSS to a programming-language setting with algebraic data types (such as ASTs). Practically, code style sheets allow ASTs to be styled granularly, based on semantic information-such as the structure of abstract syntax, static type information, and corresponding run-time values-as well as design choices on the part of authors and readers of a program. Because programs are heavily nested in structure, a key aspect of our design is a layout algorithm that renders nested, multiline text blocks more compactly than in existing box-based layout systems such as HTML.
In this paper, we design and implement a code style sheets system for a subset of Haskell, using it to illustrate several code presentation and visualization tasks. These examples demonstrate that code style sheets provide a uniform framework for rendering programs in multivarious ways, which could be employed in future designs for text-based as well as structure editors.
CCS Concepts: • Software and its engineering → Integrated and visual development environments; • Humancentered computing → Graphical user interfaces.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper2
- Ragged Blocks: Rendering Structured Text with StyleSam Cohen, Ravi ChughUIST 2025 · 被引用 1 次
- Syntactic Completions with Material ObligationsDavid Moon, Andrew Blinn, Thomas Porter, Cyrus OmarOOPSLA 2025
它引用的顶会 Paper8
- Penrose: from mathematical notation to beautiful diagramsKatherine Ye, Wode Ni, Max Krieger, Dor Ma'ayan 等SIGGRAPH 2020 · 被引用 53 次
- Projection Boxes: On-the-fly Reconfigurable Visualization for Live ProgrammingSorin LernerCHI 2020 · 被引用 52 次
- Filling typed holes with live GUIsCyrus Omar, David Moon, Andrew Blinn, Ian Voysey 等PLDI 2021 · 被引用 35 次
- Adding interactive visual syntax to textual codeLeif Andersen, Michael Ballantyne, Matthias FelleisenOOPSLA 2020 · 被引用 28 次
- Structured Editing for All: Deriving Usable Structured Editors from GrammarsTom Beckmann, Patrick Rein, Stefan Ramson, Joana Bergsiek 等CHI 2023 · 被引用 21 次
相关 Paper
- Taking ASCII Drawings Seriously: How Programmers Diagram CodeDevamardeep Hayatpur, Brian Hempel, Kathy Chen, William Duan 等CHI 2024 · 被引用 7 次
- Stylette: Styling the Web with Natural LanguageTae Soo Kim, DaEun Choi, Yoonseo Choi, Juho KimCHI 2022 · 被引用 71 次
- A Pretty Expressive PrinterSorawee Porncharoenwase, Justin Pombrio, Emina TorlakOOPSLA 2023
- AST-Trans: Code Summarization with Efficient Tree-Structured AttentionZe Tang, Xiaoyu Shen, Chuanyi Li, Jidong Ge 等ICSE 2022 · 被引用 57 次
- Interacting with Literary Style through Computational ToolsSarah Sterman, Evey Huang, Vivian Liu, Eric PaulosCHI 2020 · 被引用 14 次
