Skip to main content

A Modelica parser based on parser generator

Project description


.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::
:alt: Updates

modparc is a Modelica parser in Python based on parser combinator.

* Free software: GNU General Public License v3
* Source code:
* Documentation:

.. contents::


Install the package from PyPI:

.. code-block:: bash

$ pip install modparc

To parse a Modelica source file `""`:

.. code-block:: python

import modparc
model_definition = modparc.parse_file("")

To list all the equations in the `model_definition` instance:

.. code-block:: python

all_equations ='Equation')
for equation in all_equations:
print(equation.code()) # The code of the equation as string

To get the name of the model loaded:

.. code-block:: python

print( # get the name of the stored class
print(model_definition.class_type()) # get the type of the class


* Experimentally parses Modelica Standard Library 3.2.1
* Search element of a certain class

Known Issues

* Handling tokenization of Q-IDENT and comments, which comes first?
* Assertion syntax not defined in Modelica specification
* Default recursion depth is not enough for long vector literals
* Cyclic import is neccessary for the Modelica syntax definition


This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

The test cases used code from the `ModelicaByExample library (MIT License by Michael Tiller)`_.

.. _Cookiecutter:
.. _`audreyr/cookiecutter-pypackage`:
.. _`ModelicaByExample`:


0.1.5 (2016-10-22)

* First release on PyPI.

0.2.0 (2016-10-22)

* Get names and types of the defintions
* Roundtripping of the defintions

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for modparc, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size modparc-0.2.1-py2.py3-none-any.whl (17.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size modparc-0.2.1.tar.gz (34.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page