Search This Blog

Monday, November 12, 2018

Unix shell scripts - an example of a domain-specific language for data organization

Unix shell scripts give a good example of a domain-specific language for data organization. They can manipulate data in files or user input in many different ways. Domain abstractions and notations include streams (such as stdin and stdout) and operations on streams (such as redirection and pipe). These abstractions combine to make a robust language to talk about the flow and organization of data. The language consists of a simple interface (a script) for running and controlling processes that perform small tasks. These tasks represent the idioms of organizing data into a desired format such as tables, graphs, charts, etc. These tasks consist of simple control-flow and string manipulation mechanisms that cover a lot of common usages like searching and replacing string in files, or counting occurrences of strings (frequency counting). Even though Unix scripting languages are Turing complete, they differ from general purpose languages. In practice, scripting languages are used to weave together small Unix tools such as AWK (e.g., gawk), ls, sort or wc.