ABSTRACT
We present an extensible implementation of Modelica-style modeling semantics. Modeling features are implemented using an intuitive encoding as an extensible state monad. Monadic computation naturally yields model composition and interpretation. This in turn allows for a clear separation between the modular aspects of a modeling language (e.g. classes and inheritance) and the symbolical and numerical treatment of models: While the former can be implemented by a compiler or interpreter, the latter can be moved into a core-library to be maintained by domain-experts. In a second step, we show how the elaboration aspects of the language can be removed by a correct and complete desugaring procedure. The residual language is a simple extension of a call-by-value λ-calculus. Thus it becomes possible to implement a compiler for a modeling language using existing standard techniques.
- Modelica Association et al. Modelica: A unified object-oriented language for systems modeling-language specification version 3.3. URL="https://www.modelica.org/documents/ModelicaSpec33.pdf, 9, 2012.Google Scholar
- Andrej Bauer and Matija Pretnar. Programming with algebraic effects and handlers. Journal of Logical and Algebraic Methods in Programming, 84(1):108--123, 2015.Google ScholarCross Ref
- David Broman. Meta-Languages and Semantics for Equation-Based Modeling and Simulation. PhD thesis, Department of Computer and Information Science, Linköping University, Sweden, 2010.Google Scholar
- David Broman, Peter Fritzson, and Sébastien Furic. Types in the Modelica Language. In Proceedings of the Fifth International Modelica Conference, Vienna, Austria, 2006.Google Scholar
- David Broman and Jeremy G. Siek. Modelyze: a gradually typed host language for embedding equation-based modeling languages. Technical Report UCB/EECS-2012-173, EECS Department, University of California, Berkeley, Jun 2012.Google Scholar
- George Giorgidze and Henrik Nilsson. Embedding a functional hybrid modelling language in haskell. In Implementation and Application of Functional Languages, pages 138--155. Springer, 2008. Google ScholarDigital Library
- Christoph Höger, Florian Lorenzen, and Peter Pepper. Notes on the separate compilation of modelica. In Peter Fritzson, Edward Lee, François E. Cellier, and David Broman, editors, 3rd International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools, pages 43--51. Linköping University Electronic Press, 2010.Google Scholar
- Peter J. Landin. The mechanical evaluation of expressions. Computer Journal, 6(4):308--320, 1964.Google ScholarCross Ref
- Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Proceedings of the 22Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '95, pages 333--343, New York, NY, USA, 1995. ACM. Google ScholarDigital Library
- Sven Erik Mattsson and Gustaf Söderlind. Index reduction in differential-algebraic equations using dummy derivatives. SIAM Journal on Scientific Computing, 14(3):677--692, 1993. Google ScholarDigital Library
- Peter Pepper, Alexandra Mehlhase, Christoph Höger, and Lena Scholz. A compositional semantics for modelica-style variable-structuremodeling. In EOOLT, pages 45--54, 2011.Google Scholar
- John D Pryce. A simple structural analysis method for daes. BIT Numerical Mathematics, 41(2):364--394, 2001.Google ScholarCross Ref
- Philip Wadler. Comprehending monads. In LFP '90: Proceedings of the 1990 ACM conference on LISP and functional programming, pages 61--78, New York, NY, USA, 1990. ACM. Google ScholarDigital Library
Recommendations
The Transmogrifier C hardware description language and compiler for FPGAs
FCCM '95: Proceedings of the IEEE Symposium on FPGA's for Custom Computing MachinesAbstract: The Transmogrifier C hardware description language is almost identical to the C programming language, making it attractive to the large community of C-language programmers. This paper describes the semantics of the language and presents a ...
Implementation Correctness Involving a Language with goto Statements
Two languages, one a simple structured programming language, the other a simple goto language, are defined. A denotational semantics is given for each language. An interpreter for the goto language is given and is proved correct with respect to the ...
DSL implementation using staging and monads
DSL '99: Proceedings of the 2nd conference on Domain-specific languagesThe impact of Domain Specific Languages (DSLs) on software design is considerable. They allow programs to be more concise than equivalent programs written in a high-level programming languages. They relieve programmers from making decisions about data-...
Comments