Konferensartikel

Towards a Text Generation Template Language for Modelica

Peter Fritzson
PELAB – Programming Environment Lab, Dept. Computer Science, Linköping University, Sweden

Pavol Privitzer
Institute of Pathological Physiology, First Faculty of Medicine, University in Prague, Chezh Republic

Martin Sjölund
PELAB – Programming Environment Lab, Dept. Computer Science, Linköping University, Sweden

Adrian Pop
PELAB – Programming Environment Lab, Dept. Computer Science, Linköping University, Sweden

Ladda ner artikelhttp://dx.doi.org/10.3384/ecp09430124

Ingår i: Proceedings of the 7th International Modelica Conference; Como; Italy; 20-22 September 2009

Linköping Electronic Conference Proceedings 43:21, s. 193-207

Visa mer +

Publicerad: 2009-12-29

ISBN: 978-91-7393-513-5

ISSN: 1650-3686 (tryckt), 1650-3740 (online)

Abstract

The uses; needs; and requirements of a text generation template language for Modelica are discussed. A template language may allow more concise and readable programming of the generation of textual models; program code; or documents; from a structured model representation such as abstract syntax trees (AST). Applications can be found in generating simulation code in other programming languages from models; generation of specialized models for various applications; generation of documentation; web pages; etc. We present several template language designs and some usage examples; both C code generation and Modelica model generation. Implementation is done in the OpenModelica environment. Two designs are currently operational.

Nyckelord

Template language; unparsing; pretty printing; code generation; Modelica.

Referenser

[1] ANTLR. http://www.antlr.org. Access Nov 2007.

[2] Apache Software Foundation. Velocity Users Guide; 2008.: http://velocity.apache.org/engine/releases/velocity-1.6.1/user-guide.html. Jan 2009.

[3] Uwe Assmann. Invasive Software Composition. ISBN 3540443851; 9783540443858; 334 pages. Springer Verlag; 2003.

[4] Martin Fowler: Domain Specific Language http://www.martinfowler.com/bliki/DomainSpecificLanguage.html.

[5] Martin Fowler. Domain Specific Languages http://martinfowler.com/dslwip/

[6] Peter Fritzson. Towards a Distributed Programming Environment based on Incremental Compilation. PhD thesis no 109; Linköping University; April 13; 1984.

[7] Peter Fritzson; Peter Aronsson; Håkan Lundvall; Kaj Nyström; Adrian Pop; Levon Saldamli; and David Broman. The OpenModelica Modeling; Simulation; and Software Development Environment. Simulation News Europe; 44/45; Dec 2005. http://www.openmodelica.org

[8] Peter Fritzson. Principles of Object-Oriented Modeling and Simulation with Modelica 2.1; 940 pages; Wiley-IEEE Press; 2004. doi: 10.1109/9780470545669.

[9] Peter Fritzson; Adrian Pop; and Peter Aronsson. Towards Comprehensive Meta-Modeling and Meta-Programming Capabilities in Modelica. In Proc. of the 4th International Modelica Conference; Hamburg; Germany; March 7-8; 2005.

[10] Peter Fritzson; Adrian Pop; Kristoffer Norling; and Mikael Blom. Comment- and Indentation Preserving Refactoring and Unparsing for Modelica. In Proc. 6th Int. Modelica Conf. (Modelica’2008); Bielefeld; Germany; March.3-4; 2008.

[11] Google. ctemplate; 2008. http://code.google.com/p/google-ctemplate/. Accessed 2009.

[12] Kenneth C. Louden. Programming Languages; Principles and Practice. ISBN 0-534-95341-7; Thomson Brooks/Cole; 2003.

[13] Modelica Association. The Modelica Language Specification Version 3.0; September 2007. http://www.modelica.org.

[14] Martin Mikelsons. Prettyprinting in an interactive programming environment. In Proc. of ACM SIGPLAN SIGOA symposium on Text manipulation. Portland; Oregon; 1981.

[15] Eclipse website. http://www.eclipse.org. Referenced Nov 2007.

[16] Terence Parr. Enforcing Strict Model-View Separation in Template Engines. http://www.stringtemplate.org;. May 2004. Accessed May 2009.

[17] Terence Parr. [DRAFT] A Functional Language For Generating Structured Text. http://www.stringtemplate.org. May 2006. Accessed May 2009.

[18] Terence Parr. StringTemplate documentation. http://www.stringtemplate.org. Access May 2009.

[19] Peter Fritzson; Adrian Pop; and Peter Aronsson. Towards Comprehensive Meta-Modeling and Meta-Programming Capabilities in Modelica. In Proceedings of the 4th International Modelica Conference; Hamburg; ; March 7-8; 2005.

[20] Adrian Pop; Peter Fritzson; Andreas Remar; Elmir Jagudin; and David Akhvlediani. OpenModelica Development Environment with Eclipse Integration for Browsing; Modeling; and Debugging. In Proc 5th International Modelica Conf. (Modelica’2006); Vienna; Austria; Sept. 4-5; 2006.

[21] Adrian Pop. Integrated Model-Driven Development Environments for Equation-Based ObjectOriented Languages. www.ep.liu.se. PhD Thesis No. 1183; June 5; 2008.

[22] Martin Sjölund. Bidirectional External Function Interface Between Modelica/MetaModelica and Java. Master Thesis. Linköping Univ; Aug. 2009.

[23] Philip Wadler. A Prettier Printer. Journal of Functional Programming; 1998; pp 223-244. Draft version: homepages.inf.ed.ac.uk/wadler/papers/pret-tier/prettier.pdf Implementation PPrint by Daan Leijen

Citeringar i Crossref