Copyright © 2010 David Schmidt

Chapter 0:
An Introduction to Language Paradigms


0.1 Software-architecture paradigms
0.2 Programming paradigms
0.3 Programming language anatomy
0.4 Designing your own language to fit the job


A paradigm is a pattern or stylistic approach to doing or stating something. For example, when you prepare your resumé, you use a standard pattern, a paradigm, for formatting it. Another paradigm is the layout of the engine in a car --- although there are many different models of car, virtually all of them use the same design for their internal-combustion engine, frame, wheels, etc. Paradigms are useful to architects, who design and build skyscrapers with one paradigm and design wood-frame, family residences with another. Writers use paradigms for short stories, novels, and newspaper stories. Paradigms are used by scientists and engineers, too.

Paradigms are useful to computer hardware --- there are standard chip layouts, network layouts, etc. And there are paradigms for computer software:


0.1 Software-architecture paradigms

Before we consider programming languages and their paradigms, we review the paradigms (architectures) for building software systems. The material that follows is taken from a longer presentation, Software architecture: an informal introduction, which you are welcome to read.

In CIS501, you drew blueprints --- class diagrams and object diagrams --- that showed the architecture of systems you built: card games, graphical toys, database systems.

There are several standard architectures for software systems:


0.2 Programming paradigms

Hardware has paradigms; software has paradigms. Software is written in programming languages, and programming languages use paradigms. This course covers three standard paradigms:


0.3 Programming language anatomy

Although Prolog looks radically different from C, which looks radically different from ML or Smalltalk, all programming languages are languages, and languages have standard foundations. There is a traditional list of these foundations, which states that every language has a

To understand syntax, we will learn a notation for stating syntactic structure: grammar notation. This comes in the next chapter.

To understand semantics, we will learn about semantic domains of expressible, denotable, and storable values. We will also learn extension principles that enrich the semantic domains. Finally, we will see how languages like Java, ML, and Prolog grow from ``core'' grammars and domains by means of the extension principles.

To understand pragmatics, we will learn the standard virtual machines for computing programs in a language. The virtual machines might use variable cells, or objects, or algebra equations, or even logic laws. In any case, the machines compute execution traces of programs and show how the language is useful.


0.4 Designing your own language to fit the job

There is another reason why we study the material in this course: When you are established at a firm or a lab, you will become expert at solving problems in one application area, one domain. You will find that your solutions often match a particular software architecture and a particular programming paradigm. You will develop a library of components that you reuse when you build multiple, similar solutions to similar problems in the domain.

You will reach the point where it will be useful to share your knowledge, your libraries, your styles with others. At this point, you might wish to develop a language that is specialized to the domain. Such a language is called a domain-specific language. You use the language to talk about programs and their solutions. If you can state solutions (algorithms) in your domain-specific language, and if a computer can understand your domain-specific language (that is, you write an interpreter --- virtual machine --- for your domain-specific language), then it is a domain-specific programming language.

Most of us will never design a language like C or Java, but many of us have designed or will design domain-specific languages to solve a narrow class of problems in a specialty domain. If you want your language to be good quality, you must learn the concepts in this course about syntax, semantics, and pragmatics --- you will rely on all three to design a useful domain-specific language.

You have probably hacked code in HTML --- it's a domain-specific language for web-page layout. You might have used a gamer package to create an interactive game; you have thus used a domain-specific language for gaming. Excell is a clever, text-plus-graphics domain-specific language for spreadsheet construction. make is a hugely useful little language for importing and linking C-files into one huge C-program. And so it goes. Indeed, any nontrivial, grammatical input format for an application is a domain-specific language, with its own syntax, semantics, and pragmatics --- language design and systems design go hand in hand.