Compiling and Using Pattern Matching in Modelica

Kristian Stavåker, Adrian Pop, Peter Fritzson · International Modelica Conference · 2008

Pattern matching is a well-known, powerful language feature found in functional programming languages. In this paper we present the implementation of pattern matching for Modelica. A pattern matching construct is useful for classification and decomposition of (possibly recursive) hierarchies of components such as the union type structures in the MetaModelica language extension. We argue that pattern matching not only is useful for language specification (as in the MetaModelica case) but also to write functional-style programs. One useful application is in list processing (lists are currently missing from Modelica but are part of MetaModelica). Other possible applications are in the generation of models from other models, e.g. the generation of models with uncertainty equations or models with different parameters. Another application is the generation of documentation from models and checking of guidelines or certain properties of models.

Read the paper · More papers on PaperTik