Notes on “Notable design patterns for domain-specific languages”

June 23, 2009

Notable design patterns for domain-specific languages: Diomedis Spinellis

Spinellis seems the most prolific academic on the subject of DSLs. This is a paper from the journal of systems and software detailing “design patterns” for DSLs. I would dispute the comparison with the GoF design patterns on several criteria, but here is my summary of the patterns.

8 Patterns of DSLs

Five “Creational” patterns

  • Extend Existing Language (e.g. cfront, ratfor) [creational]
  • Restrict Existing Language (safer subsets, e.g. eliminate features) [creational]
  • Host in Existing Language (source-to-source) [creational]
  • Lexical processing for simple DSLs (lexical substition i.e. via Regexes) [creational]
  • DSL to express complicated data structures (isomorphic notation for a data structure) [creational]

Two “Structural” patterns

  • DSL as front-end to existing system (configuration of a system)[structural]
  • Partially use Existing Language(Shared constructs, e.g. yacc) [structural]

One “Behavioural” Pattern

  • Combined DSLs using process pipelines (input and output are other DSLs) [behavioral]

There’s a lot of overlap, and some of the “patterns” would be better called “perspectives”. For example, saying that  a DSL is an isomorphic notation for a data structure is really a matter of perspective, because if you push it, any notation is isomorphic for an intended data structure.

%d bloggers like this: