Designing with minilanguages involves two distinct challenges.
One is having existing minilanguages handy in your toolkit, and
recognizing when they can be applied as-is. The other is knowing when
it is appropriate to design a custom minilanguage for an application.
To help you develop both aspects of your design sense, about half of
this chapter will consist of case studies.
Case Study: sng
In Chapter6 we
which translates between
PNG and an editable
all-text representation of the same bits. The SNG data-file format is
worth reexamining for contrast here because it is not quite a
domain-specific minilanguage. It describes a data layout, but doesn't
associate any implied sequence of actions with the data.
SNG does, however, share one important characteristic with
domain-specific minilanguages that binary structured data formats like
PNG do not —
transparency. Structured data files make
it possible for editing, conversion, and generation tools to cooperate
without knowing about each others' design assumptions other than through
the medium of the minilanguage. What SNG adds is that, like a
domain-specific minilanguage, it's designed to be easy to parse by
eyeball and edit with general-purpose tools.
[an error occurred while processing this directive]