Javascript Interpreter in Functional-Style Javascript
Atum is a Javascript interpreter written in functional style Javascript. Atum is designed to be a platform for Javascript experimentation and explores the implementation and power of functional interpreters. It is part of a project developing a complete Javascript implementation in functional style Javascript.
Atum is designed as a Javascript language testing and experimentation platform. It also explores the functional implementation of imperative programming languages. As an academic project, performance is a low priority (Atum may even be the slowest Javascript implementation ever).
A few project goals:
git clone https://github.com/mattbierner/atum atum
cd atum
git submodule update --init
Direct dependencies included in the project as submodules:
Indirect dependencies, used for testing or UI or some other supporting part of the project. They are included as source files.
Atum uses require.js text to load hosted language files implementing hosted language builtins. Directly running from the file system works on Safari but generates cross origin errors in Chrome and Firefox.
To get around this, either access run atum off a webserver or disable this security restriction for development in the browser. A server using node connect is included as server.js at the top level.
cd atum
node server.js
// navigate to: http://localhost:8080/console.js
Atum is being actively developed and is not feature complete. Take a look at the issue tracker to see some features that are being worked on or are not yet implemented.
Any contribution to atum is welcome. Some ideas to get started helping Atum:
Atum is built from computations. A computation is a composable continuation based step in a program, a function mapping the current state to a new state. Computations are not used directly, but constructed with composable higher order functions that abstract program operations. All of atum is basically built from 3 computations found in 'lib/atum/compute.js': just, bind, and callcc (The concept behind Atums's computations is based on the continuation monad, but many similarities between the two are only superficial given Atum's Javascript implementation).
From the set of base computations, Javascript language computations are define. Each computation encapsulates some part of program execution that other computations can use.
Composed computations and minimal reliance on the host language allow altering core language features and introducing new language features easily. For example, try statements can be made transactional, with statements can be repurposed, or objects can be passed by value with only few changes. Combined with parse-ecma, new syntax can be introduced and implemented.
The interpreted program's state is stored in a single immutable state object. Copies of the state object can be easily created, allowing snapshots of program state to be collected.
Atum's functional implementation and state snapshots enable novel debugging of interpreted programs. This allows unique interaction with the code not possible in traditional programming language implementations.
For example, with snapshots, a theoretical debugger could step through code not only forwards, but also backwards and examine the events leading to the current state. Further, the debugger can inject new states, creating branches in the program's timeline that can be explored individually. The distinction between writing, running, and debugging code disappears; programs becomes dynamic documents programmers query, inspect, and change in real time.
More commonplace debugging tools also gain new power. Complex queries, conditional breakpoints, event logging, and stepping are easily supported and can be enhanced to take advantage of Atum's unique features.