SAL: A SIMPLE ALGORITHMIC LANGUAGE IN COMMON MUSIC Heinrich Taube University of Illinois School of Music ABSTRACT SAL is a new infix language for designing algorithmic compositions in Common Music (CM) [1], a composition environment implemented in Common Lisp [2] and Scheme [3]. SAL provides an easy-to-learn, command-style syntax that lets a composer learn algorithmic design without requiring that they first become familiar with Lisp notation. The name SAL stands for Simple Algorithmic Language -- or Secretly Another Lisp -- and is a hommage to Sal Martirano, a brilliant and influential composer who was a professor at the UIUC School of Music for many years. SAL incorporates many features of Lisp while avoiding the two most confusing aspects of Lisp programming style: prefix notation and the use of Quote to block evaluation. The result is a highly expressive language that is easy to learn. SAL also takes ideas from shell languages, and its (extendable) command set provides a consistent, clean way of interacting with the CM environment. SAL commands are typically easier (shorter, less arcane) to express than equivalent Lisp expressions. The SAL system consists of two software components: a lexer/parser that is loaded into Common Music and an editing mode that provides syntax highlighting (code colorization) and evaluation services for designing and executing SAL programs. The separation between runtime and development components allows a single CM runtime to serve multiple, concurrent SAL sessions. Using SAL the composer does not interact directly with Lisp and so does not need to learn anything about Lisp's Read/Eval/Print loop (REPL) or how to recover from Lisp error breaks. Since SAL is parsed from its string representation it is able to report better (more helpful) program error messages back to the composer than can the underlying Lisp evaluator. Lisp programming style: the use of prefix notation and expression quoting that blocks Lisp evaluation in the REPL. As a result the SAL languange is expressive but easy to learn so composers are able to start designing musical algorithms almost immediately. This, in turn, allows the newcomer to learn about the power of algorithmic composition at a very early point in the learning curve, without having to first master Lisp syntax. 2. THE SAL SYSTEM SAL consists of two software modules: a lexer/parser that is loaded into Common Music and an editing mode for developing SAL programs. The lexer/parser implements the language and the editing mode supports the design and execution of SAL programs. The fact that these modules are distinct and separate components means the runtime and development environments can be imbedded in separate software environments (Figure 1), each of which can be customized and optimized to support their specific purposes. This flexibility also allows a single CM runtime to "serve" a number of different SAL sessions running at the same time. In such a configuration, multiple users can be designing SAL programs on different computers but share a common algorithmic execution environment. Currently the SAL editing environment is implemented in X/Emacs [4]; a new cross-platform GUI environment in JUCE [5] is already under development. The Lisp side (lexer/parser) can run in any common Lisp and can communicate with the development environment(s) via several different methods: inter-process communication, socket reading/writing, and (in ECL Lisp [6]) with a direct foreign function interface. 1. INTRODUCTION Lisp is a powerful, dynamic and expressive language. It is also difficult for many people to learn! In order to understand the benefits of Lisp a student must first master its special (prefix) notation style and learn about an invisible process called Lisp evaluation. This is steep hill for anyone to climb. SAL is a language that replaces Lisp as a langage for algorithmic design while still leveraging Lisp's powerful programming environment and interactive nature. While SAL replaces Lisp parenthetical syntax it still supports many of the expressive features of the Lisp runtime environment such as lists, keywords, and loop iteration. Above all, SAL avoids the two most difficult and arcane features of Figure 1. The "generate and composition in SAL. test" model of algorithmic 121
Top of page Top of page