Bootstrapping a Compiler for an Equation-Based Object-Oriented Language
2014 (English)In: Modeling, Identification and Control, ISSN 0332-7353, E-ISSN 1890-1328, Vol. 35, no 1, 1-19 p.Article in journal (Refereed) Published
What does it mean to bootstrap a compiler, and why do it? This paper reports on the first bootstrapping of a full-scale EOO (Equation-based Object-Oriented) modeling language such as Modelica. Bootstrapping means that the compiler of a language can compile itself. However, the usual application area for the Modelica is modeling and simulation of complex physical systems. Fortunately it turns out that with some minor extensions, the Modelica language is well suited for the modeling of language semantics. We use the name MetaModelica for this slightly extended Modelica. This is a prerequisite for bootstrapping which requires that the language can be used to model and/or implement itself. The OpenModelica Compiler (OMC) has been written in this MetaModelica language. It originally supported only the standard Modelica language but has been gradually extended to also cover the MetaModelica language extensions. After substantial work, OMC is able to quickly compile itself and produces an executable with good performance. The benefits include a more extensible and maintainable compiler by introducing improved language constructs and a more powerful runtime that makes it easy to add functionality such as parser generators, debuggers, and profiling tools. Future work includes extracting and restructuring parts of OMC, making the compiler smaller and more modular and extensible. This will also make it easier to interface with OMC, making it possible to create more powerful and user-friendly OpenModelica-based tools. The compiler and its bootstrapping is a major effort -- it is currently about 330 000 lines of code, and the MetaModelica extensions are used routinely by approximately ten developers on a daily basis.
Place, publisher, year, edition, pages
Norwegian Society of Automatic Control , 2014. Vol. 35, no 1, 1-19 p.
compilation, equation-based, object-oriented, meta-programming, modeling
IdentifiersURN: urn:nbn:se:liu:diva-104894DOI: 10.4173/mic.2014.1.1ISI: 000333248800001OAI: oai:DiVA.org:liu-104894DiVA: diva2:699889