Domain Specific Language Python
Programming languages are a powerful tool and can be used to create all manner of applications however sometimes their syntax is more cumbersome than necessary.
Domain specific language python. Crest is implemented as an internal dsl using python as a host language. The approach is useful if you need a more structured solution but don t have the time or. Simply writing the function in python isn t really an option since nobody is going to want to install a server that downloads and executes arbitrary python code at runtime. You can invent your own language or build a support for already existing textual language or file format.
However it s directly usable in python with minimal effort as it s just another python library and it has a really modest learning. Regular expressions regular expressions are mini languages specialized to express string patterns to match. Based on these insights i developed crest a domain specific formalism for the modelling of continuous resource flows e g. Water heat electricity in cpss.
It is inspired by xtext. A programming or declarative language dedicated to a particular problem domain typically the language will be engineered to contain the bare minimum of constructs and consist of keywords familiar to users knowledgeable in the problem domain. In a nutshell textx will help you build your textual language in an easy way. The language needs to be capable of simple expression.
Creating domain specific languages in python 1. For example regular expressions are a dsl. Sql is a mini language specialized to retrieve data from a relational database. Compared to heavyweight language workbenches such as jetbrains mps eclipse xtext or spoofax textx is less powerful and not as feature rich.
Sqlsql is a mini language specialized to retrieve datafrom a relational database 4. Textx is a meta language for building domain specific languages dsls in python. In other words it s a programming language that s used for a more specific application or use case than a general purpose language like python. Another widely used dsl is sql.
General purpose language e g. A domain specific language or dsl for short is a language that s specialized to a particular application domain. An interview with the creator of textx about how it simplifies the work of building and using a domain specific language in python. Domain specific language dsl.
This means that all aspects and domain concepts are implemented and expressed using standard python constructs. I give an overview with a real case example on how to build your own domain specific language in python. Textx is a suite of python modules and tools to quickly develop text based domain specific languages.