Search code examples
apiparsingdsl-toolsdsl

Why are parsing tools needed for DSLs?


Couldn't a DSL be as simple as an API and therefore not need a parser? Or am I misunderstanding what a domain specific language really is? I thought it referred to any organized set of rules for solving a particular domain problem. An API would seem to fit that definition, right?


Solution

  • You can embed a DSL within a more general programming language. This is often a good solution. (You could say that this DSL takes the form of a particular API.)

    You can also create a separate language, with its own interpreter, to represent the concepts of your domain. This tends to be a larger undertaking, and is often not necessary.