Clojure Gazette 1.14

Free Beginner Workshop

From OO to Clojure Workshop!

Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.

Meta-circular interpreters

Clojure Gazette

Issue 1.14 - June 17, 2012

editorial

Metacircular Interpreters

This issue is dedicated to the metacircular interpreter. If you have never experienced the magic of metacircularity for yourself, please take this opportunity.

Basically, what we mean when we say "metacircular interpreter" is an interpreter written in itself. Typically, the implementation language is simplified to only a few forms and functions. For instance, Lisp can be written using only seven primitive operations. That is pretty good. A metacircular object system can be written using a single point of circularity!

Metacircularity is important for two reasons: it empowers an individual to bootstrap a large system from a small system and it allows for runtime reflection (querying and modification of runtime behavior). The most powerful computer systems in the world have used metacircularity, including Lisp, Smalltalk, and Forth.

Eric Normand

PS If you like the Clojure Gazette, tell your friends!

PPS Also, I love to hear what you think. Just reply to this email.
from humble beginnings
LISP 1.5 Programmer's Manual

Right there on page 13 there is a nice definition of the Lisp Metacircular interpreter: the semantics of Lisp defined in itself. Also, in Appendix B, there is a more complete definition of the Lisp 1.5 interpreter.
later analysis
The Roots of Lisp

Paul Graham hones in on the metacircular interpreter, boils it down to its essence, and codes up a modern version of the metacircular interepreter, of course written in Lisp. A good introduction to the magic of a language that interprets itself.
scheme
The Art of the Interpreter

Guy Steele and Gerald Sussman explore many programming language design decisions by modifying a metacircular interpreter in Scheme. Their base implementation is on page 9.
more from MIT
Structure and Interpretation of Computer Programs: Section 4.1

Perhaps the best description of the metacircular interpreter on the web. By the way, this book is a classic must-read.
lecture
Structure and Interpretation of Computer Programs Lecture 7A

MIT graciously provides these videos of Sussman giving lectures for free. Get a second education from MIT! This one is about the magic of the metacircular interpreter.
smalltalk
The Early History of Smalltalk (PDF—rotate it 90 degrees clockwise for a better experience)

Alan Kay explains the bet that led to Smalltalk: he bet he could write the most powerful language in the world in a page of code. (Section IV) Later, in Appendix II, he goes into great depth about his reasoning which led to the Smalltalk metacircular interpreter.
reflection
Smalltalk: A Reflective Language

This paper describes the use of the Smalltalk metacircular interpreter for reflecting on the runtime state and operation of the Smalltalk system, as well as how to modify the functionality of the kernel at runtime.
reflective towers
A Simple Reflective Interpreter

What if you had a metacircular interpreter, on which you interpreted another metacircular interpreter, on which you interpreted another metacircular interpreter? Is it metacircles all the way down? Read this paper.
exploring reflection
A Tutorial on Behavioral Reflection and its Implementation

A thorough investigation of reflection, including how runtime modification relates to compilation.
object model
Open, Extensible Object Models

The id-object system could be the simplest metacircular system to date: it is a simple C program that implements message passing in a metacirclar way: only one method of one vtable is special. Everything else can be easily replaced at runtime. And it is suitable for forming the basis of many different language semantics, including Lisps. He gives a special assignment to the reader: create a parser from a language into C which uses this object system.


Copyright © 2012 LispCast, All rights reserved.


unsubscribe from this list | update subscription preferences