# 形状语法

形状语法是一种基于规则的产生式系统，它通过对初始形状递归地应用形状替换规则来生成形状，其方式如同形式语法生成句子。它由乔治·斯提尼（George Stiny）和詹姆斯·吉普斯（James Gips）在1971年的论文《形状语法与绘画和雕塑的生成性规范》中提出，该论文以形状语法作为主要结构组件，定义了绘画和雕塑的生成性规范<sup>[1](https://www.researchgate.net/publication/221329330_%27Shape_Grammars_and_the_Generative_Specification_of_Painting_and_Sculpture%27)</sup>。这一形式化方法源自诺姆·乔姆斯基（Noam Chomsky）在语言学中使用的形式语法，经改造后用于视觉材料而非语言材料<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。

| 关键事实 | 详情 |
|---|---|
| 起源 | 由乔治·斯提尼和詹姆斯·吉普斯提出，《形状语法与绘画和雕塑的生成性规范》，IFIP大会1971年<sup>[1](https://www.researchgate.net/publication/221329330_%27Shape_Grammars_and_the_Generative_Specification_of_Painting_and_Sculpture%27)</sup><sup> • </sup><sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup> |
| 组成 | 一个有限形状集、一个有限符号集、一个有限形状规则集，以及一个初始形状（斯提尼，1980）<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup> |
| 标志性应用 | 帕拉第奥语法（斯提尼与米切尔，1978），一种生成帕拉第奥别墅平面图的参数化形状语法<sup>[3](https://ideas.repec.org/a/sae/envirb/v5y1978i1p5-18.html)</sup> |
| 核心计算问题 | 在基于图的形状表示中，参数化变换下的子形状识别是NP困难问题，2018年推广至所有表示形式<sup>[4](https://link.springer.com/chapter/10.1007/978-3-031-81623-9_22)</sup> |
| 主要应用领域 | 建筑设计、工程和产品设计，其中平面图生成是研究体量最大的方向<sup>[5](https://www.cambridge.org/core/journals/ai-edam/article/ai-edam-special-issue-advances-in-implemented-shape-grammars-solutions-and-applications/6C97D3782FAAB65CC9897C3454F425B7)</sup><sup> • </sup><sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup> |
| 实现现状 | 大多数解释器是针对具体案例的；在被评估的出版物中，11%将其解释器集成到商业软件中，这种集成自2008年以来才出现<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup> |

## 定义与机制

在斯提尼1980年的表述中，形状语法有四个组成部分：一个有限形状集、一个有限符号集、一个有限形状规则集，以及一个初始形状<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。规则被递归地应用，使用变换、布尔运算以及形状的加法或分割<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。从概念上讲，形状语法是一个由两部分组成的产生式系统：一组关于形状变换的规则，以及一个决定应用哪些规则以及何时应用的生成或行为引擎<sup>[6](https://www.igi-global.com/chapter/shape-grammar-approaches-in-architecture/245859)</sup>。

形状规则的应用涉及两个关键步骤，规则以嵌入的方式应用，利用形状外观中视觉涌现的部分<sup>[7](https://pure.strath.ac.uk/ws/portalfiles/portal/64125310/strathprints013660.pdf)</sup><sup> • </sup><sup>[8](https://arxiv.org/abs/2012.10949)</sup>。这种对视觉涌现的依赖是该形式化方法的显著特征：一条规则可以应用于一个从未被明确绘制、但在当前设计中变得可见的子形状，因此设计的结构是根据所应用的形状规则回溯性地定义的<sup>[9](https://citeseerx.ist.psu.edu/document?doi=3461b84a34311e88ac20b7d0d65cbdcf6b523995&repid=rep1&type=pdf)</sup>。

**参数化规则。** 参数化形状语法由斯提尼于1977年提出，允许规则中的形状携带参数，帕拉第奥语法使用的正是这种形式<sup>[10](https://www.andrew.cmu.edu/course/48-747/subFrames/readings/Stiny%26Mitchell.thePalladianGrammar.pdf)</sup>。语法也可以携带非几何信息：斯提尼考虑了一种描述函数，由分配给形状规则并并行计算的函数组成，而杜阿尔特（Duarte）将这些函数称为描述规则，将整体称为描述语法<sup>[11](https://ecaade.org/downloads/eCAADe2016_volume2_lowres.pdf)</sup>。

## 历史与标志性应用

斯提尼和吉普斯在1971年的论文中首次提出形状语法，该论文发表于《1971年最佳计算机论文》，在引用索引中页码为1460–1465<sup>[1](https://www.researchgate.net/publication/221329330_%27Shape_Grammars_and_the_Generative_Specification_of_Painting_and_Sculpture%27)</sup><sup> • </sup><sup>[12](https://jglobal.jst.go.jp/en/detail?JGLOBAL_ID=201602019669879784)</sup>。1978年，斯提尼和W. J. 米切尔（W. J. Mitchell）开发了一种参数化形状语法，生成帕拉第奥别墅的平面图，作为帕拉第奥风格的定义，并将其应用于生成马尔康滕塔别墅的平面图<sup>[3](https://ideas.repec.org/a/sae/envirb/v5y1978i1p5-18.html)</sup>。1981年，科宁（Koning）和艾森伯格（Eisenberg）提出了弗兰克·劳埃德·赖特（Frank Lloyd Wright）草原住宅设计语言的形状语法推导，展示了形状语法对建筑目的和一般形状的适用性<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。米切尔后来的功能语法纳入了对可用材料和制造方法的实际考量，为推导建筑的规则增加了物理约束<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。

2023年发表的一项系统性映射发现，自1985年以来形状语法出版物逐年持续增长，并得出结论：大多数历史性进展涉及不考虑工程因素的二维平面图生成<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。

## 应用

**建筑与工程。** 在建筑领域，一个流行的应用是平面图生成，使用旋转、分割、缩放和对称等规则；具有结构意识的规则可以为梁和柱等元素分配材料和尺寸，从而使过程更具结构感知能力<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。当纳入结构工程时，优化通常随之而来：形状语法与工程的结合最初涉及桁架结构的优化，性能驱动的优化与形状语法相结合在1990年代于桁架上得到演示。在过去15年中，优化应用已多样化到包括结构效率、环境性能、太阳能发电和平面图布局等目标<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。形状退火——使用模拟退火对形状和结构进行优化——是一种相关方法<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。

**城市设计与交通。** 形状语法、L系统和元胞自动机是应用于城市形态生成的三种典型的基于规则的生成方法，其中城市元素被表示为几何形状，变换后的几何体作为设计方案的视觉表示<sup>[13](https://www.sciencedirect.com/science/article/pii/S0305900623000569)</sup>。交通和城市规划者越来越多地部署形状语法，尤其是在模拟和程序化模型中，一种提出的评估方法通过弹性来评估语法规则，以比较和验证单个规则的效果<sup>[14](https://doaj.org/article/bba89e1de072429baacab86d458445a7)</sup>。程序化建模的发展使形状语法对于生成式设计变得可行，能够根据用户定义的规则快速生成从单栋建筑到整个城市的大规模三维模型<sup>[15](https://link.springer.com/article/10.1057/s41289-026-00329-3)</sup>。

**产品设计与教育。** 形状语法工具已被应用于产品设计，汽车设计的例子展示了形状语法工具的应用<sup>[16](https://www.designsociety.org/publication/19793/improving_product_design_via_a_shape_grammar_tool)</sup>。在建筑教育中，形状语法已作为三维视觉构图的视觉编码工具被整合，设计过程基于视觉感知，在组装中遵循特定的变换规则<sup>[17](https://link.springer.com/article/10.1007/s00004-022-00608-w)</sup>。

## 实现与计算限制

形状语法应用已发展超过40年，尤其在建筑设计、工程和产品设计中最为突出。过去十年的实现将早期形状表示和计算工作与参数化设计工具、生成式设计工具、程序化建模工具、信息建模应用和基于规则的设计系统相结合，提供对欧几里得规则和参数化规则的支持、规则的视觉定义，以及手动、半自动和自动模式下的交互式规则应用<sup>[5](https://www.cambridge.org/core/journals/ai-edam/article/ai-edam-special-issue-advances-in-implemented-shape-grammars-solutions-and-applications/6C97D3782FAAB65CC9897C3454F425B7)</sup>。

**子形状识别障碍。** 实现中最根本的挑战是子形状识别，即寻找可作为规则应用候选的形状的问题。在2013年的一项研究中，岳（Yue）和克里希纳穆尔蒂（Krishnamurti）证明，当涉及参数化变换时，在基于图的形状表示中识别子形状是一个NP困难问题；沃特曼（Wortmann）和斯托夫斯（Stouffs）（2018）后来将此结果扩展至所有表示形式。计算复杂度相对于输入形状呈指数增长，因此实践中只有形状非常简单的规则（如三角形或四边形）才可行。由于子形状识别需要枚举所有可能的解而非单一最优解，这种指数级成本与计算架构无关，而一个能让设计者在任何时候使用任何规则的通用解释器在可预见的未来仍无法实现<sup>[4](https://link.springer.com/chapter/10.1007/978-3-031-81623-9_22)</sup>。

**现有解释器的局限。** 一项对形状语法解释器的调查得出结论，它们具有共同的局限性：许多仅在二维形状上计算，大多数不应用子形状检测因此不支持涌现，极少数允许使用符号进行规则操作<sup>[11](https://ecaade.org/downloads/eCAADe2016_volume2_lowres.pdf)</sup>。大多数实现仅实现了形状语法最初被赋予的部分潜力，将涌现、交互性和歧义性等特征搁置一旁，转而支持其他特征<sup>[5](https://www.cambridge.org/core/journals/ai-edam/article/ai-edam-special-issue-advances-in-implemented-shape-grammars-solutions-and-applications/6C97D3782FAAB65CC9897C3454F425B7)</sup>。子形状的自动检测仍然是该领域内一个开放的研究问题<sup>[7](https://pure.strath.ac.uk/ws/portalfiles/portal/64125310/strathprints013660.pdf)</sup>。

**当前的通用解释器。** 两个雄心勃勃的通用形状语法解释器旨在应对这些挑战：Shape Machine，支持二维线段和弧作为操作数，在等距、相似和仿射变换下运行；以及Sortal GI，支持多种空间和非空间元素，具有非参数化和参数化关联匹配机制。两者均作为Rhinoceros 3D及其可视化编程平台Grasshopper的插件实现。在该报道发表时，Shape Machine尚未公开发布，而Sortal GI在food4rhino上约4,000次的下载量与Lunchbox、Ladybug Tools和Kangaroo Physics等插件相比微不足道，后者各自拥有数十万次下载<sup>[4](https://link.springer.com/chapter/10.1007/978-3-031-81623-9_22)</sup>。洪（Hong）和埃科诺穆（Economou）近期的一篇综述定义了形状语法解释器的五项标准，并综述了61个解释器<sup>[18](https://doi.org/10.1115/1.4070095)</sup>。

## 涌现与创造力

涌现——在不断发展的设计中识别出未预料到的特征——支持形状语法计算中的创造力。该形式化方法第一个四分之一世纪的研究表明，在严格限定的设计空间内，发挥创造力并生成创新设计是可能的；开发支持涌现的生成系统需要无限制的语法和形状表示形式模型，并辅以精心选择的限制以保证计算可行性<sup>[19](https://www.nist.gov/publications/emergence-creativity-and-computational-tractability-shape-grammers)</sup>。

## 与其他生成方法的关系

形状语法属于更广泛的生成式设计方法家族。一篇关于建筑中生成式设计的方法论综述识别出三个谱系：用于拓扑和形状优化的数学优化方法、包括形状语法和图语法在内的生成语法，以及基于智能体的设计博弈<sup>[20](https://research.utwente.nl/en/publications/generative-design-in-architecture-from-mathematical-optimization-/)</sup>。与设计空间受限于参数极值的参数化模型相比，基于规则的操作提供了拓宽探索的途径<sup>[2](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)</sup>。最近，形状语法已与文本到图像AI模型作为计算机辅助概念设计的生成方法进行比较，并与深度学习相结合：语法驱动的数据生成已被探索用于机器对三维对象的理解，形式设计语法已被提出以扩展大型语言模型的设计生成能力<sup>[21](https://www.sciencedirect.com/science/article/pii/S0166361524000964)</sup><sup> • </sup><sup>[22](https://pmc.ncbi.nlm.nih.gov/articles/PMC11207756/)</sup><sup> • </sup><sup>[18](https://doi.org/10.1115/1.4070095)</sup>。生成式设计语法实际应用的一个主要障碍仍然是创建语法本身所需的精力和技能<sup>[18](https://doi.org/10.1115/1.4070095)</sup>。

## References

1. [Stiny, G. and Gips, J. Shape Grammars and the Generative Specification of Painting and Sculpture (ResearchGate record)](https://www.researchgate.net/publication/221329330_%27Shape_Grammars_and_the_Generative_Specification_of_Painting_and_Sculpture%27)
2. [Haakonsen, S. M., Rønnquist, A., Labonnote, N. (2023). Fifty years of shape grammars: A systematic mapping of its application in engineering and architecture. SAGE](https://journals.sagepub.com/doi/full/10.1177/14780771221089882)
3. [Stiny, G. and Mitchell, W. J. (1978). The Palladian Grammar. Environment and Planning B, 5, 5–18](https://ideas.repec.org/a/sae/envirb/v5y1978i1p5-18.html)
4. [What Does Shape Grammar Implementation Tell Us About Artificial Intelligence in Architectural Design? Springer](https://link.springer.com/chapter/10.1007/978-3-031-81623-9_22)
5. [AI EDAM special issue: advances in implemented shape grammars: solutions and applications. Cambridge Core](https://www.cambridge.org/core/journals/ai-edam/article/ai-edam-special-issue-advances-in-implemented-shape-grammars-solutions-and-applications/6C97D3782FAAB65CC9897C3454F425B7)
6. [Shape Grammar Approaches in Architecture. IGI Global](https://www.igi-global.com/chapter/shape-grammar-approaches-in-architecture/245859)
7. [untitled](https://pure.strath.ac.uk/ws/portalfiles/portal/64125310/strathprints013660.pdf)
8. [Analysis of shape grammars: continuity of rules. arXiv](https://arxiv.org/abs/2012.10949)
9. [Open Research Online: shape grammar formalism and retrospective structure](https://citeseerx.ist.psu.edu/document?doi=3461b84a34311e88ac20b7d0d65cbdcf6b523995&repid=rep1&type=pdf)
10. [Stiny, G. and Mitchell, W. J. The Palladian Grammar (full PDF), Carnegie Mellon University course readings](https://www.andrew.cmu.edu/course/48-747/subFrames/readings/Stiny%26Mitchell.thePalladianGrammar.pdf)
11. [Beirão survey of shape grammar interpreters, eCAADe 2016 proceedings](https://ecaade.org/downloads/eCAADe2016_volume2_lowres.pdf)
12. [J-GLOBAL article record: Shape grammars and the generative specification of painting and sculpture](https://jglobal.jst.go.jp/en/detail?JGLOBAL_ID=201602019669879784)
13. [Generative urban design: A systematic review on problem formulation, design generation, and decision-making. ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0305900623000569)
14. [Vitins, B. J. and Axhausen, K. Shape grammars overview and assessment for transport and urban design. Journal of Transport and Land Use via DOAJ](https://doaj.org/article/bba89e1de072429baacab86d458445a7)
15. [Modelling urban elements and patterns as shape grammars: lessons from an urban design studio in Singapore. Urban Design International](https://link.springer.com/article/10.1057/s41289-026-00329-3)
16. [Improving Product Design via a Shape Grammar Tool. The Design Society](https://www.designsociety.org/publication/19793/improving_product_design_via_a_shape_grammar_tool)
17. [Learning by Doing: Integrating Shape Grammar as a Visual Coding Tool in Architectural Curricula. Nexus Network Journal](https://link.springer.com/article/10.1007/s00004-022-00608-w)
18. [Expanding the Generative Power of Large Language Models for Design Through Formal Design Grammars and Languages. ASME Journal of Computing and Information Science in Engineering](https://doi.org/10.1115/1.4070095)
19. [Chase, S. (1997). Emergence, Creativity, and Computational Tractability in Shape Grammars. NIST](https://www.nist.gov/publications/emergence-creativity-and-computational-tractability-shape-grammers)
20. [Generative Design in Architecture: From Mathematical Optimization to Grammatical Customization. University of Twente](https://research.utwente.nl/en/publications/generative-design-in-architecture-from-mathematical-optimization-/)
21. [Computers as co-creative assistants: text-to-image AI models for computer aided conceptual design. ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0166361524000964)
22. [Bridging Formal Shape Models and Deep Learning: A Novel Fusion for Understanding 3D Objects. PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC11207756/)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Formal languages and automata theory › Grammar formalisms and generating systems

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/shape-grammar

English original: https://www.edgepedia.org/shape-grammar
