Tern: A descriptive language

Synopsis and benefits

Tern is a descriptive language for defining subjects by the behaviors and properties they share with others: That is, the patterns they exhibit. The name `Tern', which is a kind of sea-bird, derives from the last four letters of `pattern'. `Pattern', in this case, is used as in the context of `Design Patterns', the movement based on the seminal book of that name and the work of Christopher Alexander.

Tern is a useful tool for the design pattern community itself, providing a language for describing patterns and pattern languages (glossaries of patterns) that is itself a standardized pattern language.

Perhaps even more importantly, it provides a tool for programmers to describe programs---as generally and abstractly or as specifically and hand-tuned as they desire---and leave whatever they don't need or want to specify open to interpretation.


A complete language specification, with example code and illustrative, more user-oriented documentation. Pattern languages for describing low-level programming idioms, text, and patterns and pattern languages themselves. A practical, optimizing interpreter is beyond the scope of a summer project, but a simple, brute-force interpreter capable of demonstrating some sample code will be delivered.

Project details

Abstraction is the base of high-level programming languages. It makes it easy to write powerful programs in a concise way, write generic code, re-use it, and run it in a variety of different environments. In a sense, the study of abstraction is the study of what patterns may be found in data. The abstract data type of a list, for example, describes a pattern of behavior; the data that implement it is left to interpretation.

The advantage of low-level languages, however, is seen in control, optimization, and speed, at the cost of abstraction and portability.

Tern will have a single syntactical unit, to state that a given context exhibits a certain pattern. All semantics of the description will be in the ways patterns can be implemented in other, lower-level patterns, down to an atomic level that can be executed, printed, or otherwise handled. The language will be learn-able in ten seconds, and provide the expressive power of whatever the community and the developer can devise.

And, since patterns exist in life at all levels, a programmer can describe the program at any level too, from object interaction to machine instructions, even describing different parts of the program at different levels of abstraction. They will be able to run it, generate code from it in any language, and take advantage whatever they do with it of their abstractions and their optimizations.

Project schedule

Writing the standard will take the entire summer. I plan to have a complete draft by July 22. I will beg comments on the draft and edit it throughout the summer. As I go, I will write user-level explanatory documents, focusing on them more as the standard solidifies more. I will work on example code as soon as the basics of the standard are established, and I suspect these snippets will provide their own motivation for development as I discover uses I couldn't anticipate. (It should be noted that the pattern languages used to describe programs, etc. will themselves be code examples; in Tern, there is no separation between describing patterns and describing programs or anything else.) When the complete draft is completed, I will begin implementing the simple interpreter and maintain it alongside the standard.


I am a junior pursuing a computer science degree at Rensselaer Polytechnic Institute. Working with Bart Massey on the Nickle programming language, I have learned a great deal about programming language design and implementation, and user documentation. I have learned about specifications researching Internet standards in order to write a mail client for Xerox supporting those relevant. I have learned about patterns and used them in and out of school, and have explored the community. I have seven years of programming experience in multiple languages, enough to learn my own patterns between them and in using them.