A little language
is a domain-specific language
designed to be very small and focussed on doing just
what the designers of it had in mind. The term comes from Little Languages
, Programming Pearls, Jon Benley, Communications of the ACM 29
:8 (August 1986), pp. 711-721. He points out that much of what we do as programmers can be thought of as creating "little languages" that are suited to particular small tasks.DKF
: It is the Tcl experience that little languages tend to grow. After all, that's what Tcl started out as: a common little language for John Ousterhout
's EDA tools.
For a very good example see Solving cryptarithms
, especially the examples at end! To prevent over-deep brace nesting, a custom language for such riddles is designed and put to fascinating use.
The Tcl language is itself "little." Its formal syntax is described completely in eleven (twelve since version 8.5) short paragraphs on the Tcl
manual page. Most of its power comes from the fact that it is easy to embed other little languages within it. Obvious examples include:
- Regular Expressions
- regexp, regsub, and others
- pattern matching
- whose language is also used in if, for, and while selectors
- adds specialties like %W substitution, + command prefix, break outside loops
- bind sequences
- e.g. <Control-Button-1>
- format/scan/binary format/binary scan
- clock format
- command indices can be specified as end-1 or $var+1 or similar.
- includes syntax for redirection and variable substitution
- | is a special syntax at the beginning of a file name argument
- Variable names
- as seen in the first argument of set, and lots of other commands. (disputed)
- item ids.
All of these are comparatively small and self-contained, and do not have far-ranging effects on the rest of the Tcl system. In this way, Tcl can be understood in pieces; it's not necessary to know the whole language in order to be able to program in it.
These can all be considered particular domain-specific language
: Some of these seem a little dubious to be called "languages". s