10 ms·
Python as a DSL (2017)
- dozzie 9y ago> In this post, we will show examples of Python as a Domain Specific Language (or DSL) and explain how to do it well --and how to avoid doing it badly. Step one: define a language that is specific to some domain. Step two: write in Python a parser for that language. If you use Python directly, you don't have domain specific language, you have a general purpose language with some weirdly structured API. You get all the things that make a general purpose language a bad match for the uses where a proper DSL would shine.