proj-plbook-plPartTargetLanguages

Table of Contents for Programming Languages: a survey

Intermediate languages

There are many languages whose goal is not to be a good language for humans to write or read code in, but rather to be a good language for a compiler or interpreter to target.

I am interested in reading about many different intermediate languages, not because i want to target them myself, but rather because they tend to clearly lay out a relatively small set of primitive operations upon which a higher-level language may be built. So, studying them may be one way to get a handle on the known design space for sets of primitive operations. The same rationale also motivates the study of assembly language instruction sets. The study of intermediate languages for specific high-level languages might also be useful to capture the 'essence' of the higher-level languages targeting them.

For example, i found "The Roots of Lisp" and Nock to be enlightening.

For these reasons I am particularly interested in listing the instruction sets of various languages. Because the goal is to allow the reader to get a sense of the language, a bird's eye overview, I've tried to fit these lists into a relatively small amount of space so that you can see the whole language at a glance. In order to do this, i've sometimes omitted instructions that i consider to be uninteresting, or obvious variants of listed instructions, and i sometimes omit definitions and explanations that can be guessed from the instruction names.

These chapter are (mostly) divided into three sets:

In addition, intermediate languages can be divided into 'Core' languages, which often represent code as ASTs and which sometimes capture the essence of a high-level language's abstract machine paradigm, and 'bytecode' languages, which are serialized, and which vary from serialized core languages, to lower-level portable bridges between the higher-level languages and assembly.

Note that for many of these target languages, many of the operations could be replaced by a single parameterized operation (call it "call_primitive" or "apply_primitive" or "primitive") which represents calls into a standard library of built-in functions, whereas other operations are qualitatively different (such as control flow operators like 'if').

For discussion of these languages being used in implementations, see Chapter ?: Programming language implementation case studies

Surveys and classifications of intermediate languages

Mostly from http://cs.lmu.edu/~ray/notes/ir/ . For examples of the following, see that link.

Styles: "

Levels:

Does a language have:

Links:

General notes on intermediate languages

"Some structures generally associated with IRs include

" [1]

CFG:

"A control flow graph is a graph whose nodes are basic blocks and whose edges are transitions between blocks." [2]

A basic block is a maximal sequence of instructions containing in its interior no branches/jumps, or branch/jump targets. That is to say, a basic block is a sequence of instructions that is only ever executed in its entirely. [3]

Links:

Discussion/Links

Kragen Javier Sitaker compares Fibonacci in various target languages:

https://web.archive.org/web/20120811013032/http://lists.canonical.org/pipermail/kragen-tol/2007-September/000871.html (alternate link: http://www.1strecon.org/downloads/Forth_Resources/ByteCodeInterpretters_4_TinyComputers.pdf ) discussion:

http://thread.gmane.org/gmane.culture.people.kragen.thinking/94

todo


Chapters