Implementation of a Modelica compiler using JastAdd attribute grammars
(2010) In Science of Computer Programming 75(1-2). p.21-38- Abstract
- We have implemented a compiler for key parts of Modelica, an object-oriented language supporting equation-based modeling and simulation of complex physical systems. The compiler is extensible, to support experiments with emerging tools for physical models. To achieve extensibility, the implementation is done declaratively in JastAdd, a metacompilation system supporting modern attribute grammar mechanisms such as reference attributes and nonterminal attributes. This paper reports on experiences from this implementation. For name and type analyses, we illustrate how declarative design strategies, originally developed for a Java compiler, could be reused to support Modelica's advanced features of multiple inheritance and structural subtyping.... (More)
- We have implemented a compiler for key parts of Modelica, an object-oriented language supporting equation-based modeling and simulation of complex physical systems. The compiler is extensible, to support experiments with emerging tools for physical models. To achieve extensibility, the implementation is done declaratively in JastAdd, a metacompilation system supporting modern attribute grammar mechanisms such as reference attributes and nonterminal attributes. This paper reports on experiences from this implementation. For name and type analyses, we illustrate how declarative design strategies, originally developed for a Java compiler, could be reused to support Modelica's advanced features of multiple inheritance and structural subtyping. Furthermore, we present new general design strategies for declarative generation of target ASTs from source ASTs. We illustrate how these strategies are used to resolve a generics-like feature of Modelica called modifications, and to support flattening, a fundamental part of Modelica compilation. To validate that the approach is practical, we have compared the execution speed of our compiler to two existing Modelica compilers. (Less)
Please use this url to cite or link to this publication:
https://lup.lub.lu.se/record/1685130
- author
- Åkesson, Johan
LU
; Ekman, Torbjörn
LU
and Hedin, Görel
LU
- organization
- publishing date
- 2010
- type
- Contribution to journal
- publication status
- published
- subject
- in
- Science of Computer Programming
- volume
- 75
- issue
- 1-2
- pages
- 21 - 38
- publisher
- Elsevier
- external identifiers
-
- scopus:70450277180
- ISSN
- 0167-6423
- DOI
- 10.1016/j.scico.2009.07.003
- project
- Embedded Applications Software Engineering
- language
- English
- LU publication?
- yes
- id
- db069ae5-6d36-46ad-a339-f20f1546fdc7 (old id 1685130)
- date added to LUP
- 2016-04-01 12:58:10
- date last changed
- 2024-01-09 06:10:29
@article{db069ae5-6d36-46ad-a339-f20f1546fdc7, abstract = {{We have implemented a compiler for key parts of Modelica, an object-oriented language supporting equation-based modeling and simulation of complex physical systems. The compiler is extensible, to support experiments with emerging tools for physical models. To achieve extensibility, the implementation is done declaratively in JastAdd, a metacompilation system supporting modern attribute grammar mechanisms such as reference attributes and nonterminal attributes. This paper reports on experiences from this implementation. For name and type analyses, we illustrate how declarative design strategies, originally developed for a Java compiler, could be reused to support Modelica's advanced features of multiple inheritance and structural subtyping. Furthermore, we present new general design strategies for declarative generation of target ASTs from source ASTs. We illustrate how these strategies are used to resolve a generics-like feature of Modelica called modifications, and to support flattening, a fundamental part of Modelica compilation. To validate that the approach is practical, we have compared the execution speed of our compiler to two existing Modelica compilers.}}, author = {{Åkesson, Johan and Ekman, Torbjörn and Hedin, Görel}}, issn = {{0167-6423}}, language = {{eng}}, number = {{1-2}}, pages = {{21--38}}, publisher = {{Elsevier}}, series = {{Science of Computer Programming}}, title = {{Implementation of a Modelica compiler using JastAdd attribute grammars}}, url = {{http://dx.doi.org/10.1016/j.scico.2009.07.003}}, doi = {{10.1016/j.scico.2009.07.003}}, volume = {{75}}, year = {{2010}}, }