Abstract
It is not uncommon to design a programming language as a core language with additional features that define some semantic analyses, but delegate others to their translation to the core. Many analyses require contextual information, such as a typing environment. When this is the same for a term under a new feature and under that feature's core translation, then the term (and computations over it) can be shared, with context provided by the translation. This avoids redundant, and sometimes exponential computations. This paper brings sharing of terms and specification of context to forwarding, a language extensibility mechanism in attribute grammars. Here context is defined by equations for inherited attributes that provide (the same) values to shared trees. Applying these techniques to the ableC extensible C compiler replaced around 80% of the cases in which tree sharing was achieved by a crude mechanism that prevented sharing context specifications and limited language extensibility. It also replaced all cases in which this mechanism was used to avoid exponential computations and allowed the removal of many, now unneeded, inherited attribute equations.
Original language | English (US) |
---|---|
Title of host publication | SLE 2023 - Proceedings of the 16th ACM SIGPLAN International Conference on Software Language Engineering, Co-located with |
Subtitle of host publication | SPLASH 2023 |
Editors | Joao Saraiva, Thomas Degueule, Elizabeth Scott |
Publisher | Association for Computing Machinery, Inc |
Pages | 56-69 |
Number of pages | 14 |
ISBN (Electronic) | 9798400703966 |
DOIs | |
State | Published - Oct 23 2023 |
Event | 16th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2023 - Cascais, Portugal Duration: Oct 23 2023 → Oct 24 2023 |
Publication series
Name | Proceedings of the 16th ACM SIGPLAN International Conference on Software Language Engineering |
---|
Conference
Conference | 16th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2023 |
---|---|
Country/Territory | Portugal |
City | Cascais |
Period | 10/23/23 → 10/24/23 |
Bibliographical note
Publisher Copyright:© 2023 ACM.
Keywords
- attribute grammars
- compilers
- modular and extensible languages
- static analysis
- well-definedness