Almost done with the book "Domain-specific languages". Great book!
To try out the ideas in the book, I implemented a simple DLS in python then in Java.
The DSL is a simple language describing image processing tasks. The user can define his/her tasks in a friendly "internal DSL" format, which is embedded in Python. That definition is used to populate a semantic model, also in Python, in which objects represent the sequence and type of the operations in the user task.
Once populated, the semantic model can be validated in various ways, and finally code is generated from Python, and a new program is created (written in Processing) that can easily be run by the user.
The same is also re-done also using Java as "host" language, for the DSL. Still the final code is generated in Processing.
The advantage of this approach is that it cleanly partitions the system in a DSL that the user can use directly, a semantic model, that the programmer can improve incrementally; then we have validation of the semantic model and code generation that can also be improved independently from the user, who will still be able to run his/her scripts.
Also, the code-generation part of the system, can be extended to create multiple executable and deploy on different machines.
Wednesday, May 04, 2011
DSL (domain-specific languages)
By at 20:38
Section: Personal, Programming languages
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment