COLA (software architecture)
Encyclopedia
COLA stands for Combined Object Lambda Architecture, and is a system for experimenting with software
Computer software
Computer software, or just software, is a collection of computer programs and related data that provide the instructions for telling a computer what to do and how to do it....

 design
Software design
Software design is a process of problem solving and planning for a software solution. After the purpose and specifications of software are determined, software developers will design or employ designers to develop a plan for a solution...

 currently being investigated by the Viewpoints Research Institute
Viewpoints Research Institute
Started by Alan Kay, Viewpoints Research Institute is a nonprofit public benefit organization incorporated in 2001 to improve "powerful ideas education" for the world's children and to advance the state of systems research and personal computing...

. A COLA is a self-describing language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 in two parts, an object
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 system which is implemented in terms of objects, and a functional
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 language to describe the computation to perform.

Since a COLA is written in itself, the whole environment (when bootstrapped
Bootstrapping (compilers)
In computer science, bootstrapping is the process of writing a compiler in the target programming language which it is intended to compile...

) can be rewritten and extended by programming with the COLA; in other words, it does not require more knowledge to rewrite a COLA than it does to write a program to run in it (as opposed to running Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 code in CPython
CPython
CPython is the default, most-widely used implementation of the Python programming language. It is written in C. In addition to CPython, there are two other production-quality Python implementations: Jython, written in Java, and IronPython, which is written for the Common Language Runtime. There...

 for example, which requires knowledge of C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 in order to reprogram the language).

This flexibility has led to the work-in-progress COLA called 'idst' becoming the implementation vehicle of choice for the Viewpoints Research Institute's research into 'reinventing programming', since it allows rapid creation and modification of new programming languages for study.

Description

A COLA is designed to be the simplest possible language which can be described in itself, so that the implementation exactly describes itself. In order to do this the structure of the environment is separated from the semantics of the computation performed.

The object system describes the structure of a prototype-based
Prototype-based programming
Prototype-based programming is a style of object-oriented programming in which classes are not present, and behavior reuse is performed via a process of cloning existing objects that serve as prototypes. This model can also be known as classless, prototype-oriented or instance-based programming...

 Object Oriented environment. This is implemented in terms of objects and message passing, which is in fact the same system it is describing. This allows modification of the system by using the same object oriented knowledge used to write any other application.

This object system is turned into a useful programming language by complementing it with a functional language describing what each object's methods do. The methods called from the object language are closures
Closure (computer science)
In computer science, a closure is a function together with a referencing environment for the non-local variables of that function. A closure allows a function to access variables outside its typical scope. Such a function is said to be "closed over" its free variables...

 running a functional programming language.

Combined together, these two parts form a complete prototype-based Object Oriented programming language which is entirely self-hosting.

Natural Language Analogy

In order to illustrate the concept we can consider an analogy in natural language, say English. To define the whole of English for someone who speaks a foreign language would be a monumental task, especially since it would have to be done over and over again for each foreign language we're coming from. However, we could instead define a simpler subset of English as a base which is just expressive enough to understand definitions given in English. For example, such a subset would not need a word for "giraffe", since it could be added later with a statement like "A giraffe is a herbivore with a long neck." Similarly the definitions of herbivore, neck and long can be added later with other statements, and so on. This way we can remove every part of English which we do not need in our subset.

The bits we keep are those which are needed to understand definitions and statements (so that we can expand the language later), along with everything needed to define those, and so on. What we end up with is a self-contained language, written in itself (a subset of English) and capable of being expanded with statements like the giraffe one above.

Any English speaker is thus capable of changing the language itself as easily as they speak (since it's defined in English) by rewriting, overriding or bypassing the statements given in the base, turning the language into anything (including existing ones).

Also, anyone can become an English speaker simply by having this base translated into their native tongue (a more tractable problem than translating the whole of English). Once they know this subset then they know enough English to understand other statements like the giraffe one, and thus grow their knowledge to the whole language through English sentences (which can be reused by everyone, regardless of their first language). This is analogous to the bootstrapping and compatibility of a COLA.

The way a COLA such as idst implements this can be thought of as defining words using other words (the object system) separately to defining the grammar (the functional language).

Features

A COLA can be used in two ways:

Due to their flexible and extensibility it is possible to make COLAs compatible with many ABI
Application binary interface
In computer software, an application binary interface describes the low-level interface between an application program and the operating system or another application.- Description :...

s, which allows integration into existing libraries (for example, those written in C) whilst maintaining the ability to mutate the COLA into another (perhaps custom) language.

A completely COLA-based computer system, whilst capable of implementing the operating system, libraries, applications and other levels of a traditional computer system, allows these distinctions to blur or disappear if the end-user wishes. Every aspect of the computer system, since it is written in a COLA (including the COLA itself), can be overridden, mutated, bypassed, etc. just as the local datastructures and functions in a traditional program can. There is also flexibility in how code is run, since there is a choice of interpreting, static compilation, dynamic compilation, in fact if the COLA is given a suitable backend object then it can even reprogram FPGA
Field-programmable gate array
A field-programmable gate array is an integrated circuit designed to be configured by the customer or designer after manufacturing—hence "field-programmable"...

's to run arbitrary sections of the system.

Idst

Ian Piumarta's 'idst' system (the name is currently in flux) is a work-in-progress implementation of a COLA. It consists of several components, such as the Id object model, the Jolt function language and the Pepsi object oriented language. Pepsi was bootstrapped by writing two Pepsi compilers, one in C++ and one in Pepsi, then compiling the latter with the former, then in with itself. This made Pepsi self-hosting, and the C++ version was discarded.

Projects

The idst COLA has already been used in the following projects:

OMeta - An object oriented pattern matching language based on Parsing Expression Grammars
Parsing expression grammar
A parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language...



JOHN - A goal-oriented programming language

JITBLT - An image compositing engine
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK