OpenMath / py-openmath

An OpenMath 2.0 implementation in Python
MIT License
15 stars 4 forks source link

Add classes to use OpenMath as a DSL #21

Closed tkw1536 closed 5 years ago

tkw1536 commented 5 years ago

This PR adds syntactic sugar to use OpenMath as a DSL inside Python.

For example:

>>> from openmath.helpers import CDBaseHelper
>>> cd = CDBaseHelper('http://www.openmath.org/cd')
>>> one_plus_one = cd.arith1.plus(1, 1)
>>> print(one_plus_one)
    OMApplication(
      elem=OMSymbol(name='plus', cd='arith1', cdbase='http://www.openmath.org/cd'),
      arguments=[
        OMInteger(integer=1),
        OMInteger(integer=1)])