git @ Cat's Eye Technologies Argyle / 9b17cc4
9b17cc4

Tree @9b17cc4 (Download .tar.gz)

Argyle

Argyle is a Lisp-like programming language which is homoiconic at a higher level than Lisp: an Argyle program is represented with an Abstract Binding Trees (ABTs), and ABTs are first-class values. These ABTs are also hygienic in the sense that all defined ABT operations are, quite unlike Lisp's cons lists, designed to preserve their name-binding structure.

This is an embryonic iteration of the language, aiming only to present a proof-of-concept. The basic ideas are implemented but their exact design and implementation surely can and ideally will be improved upon.

For more details on the language, see "Documentation" below.

Quick Start

Assuming you have a relatively modern version of ghc installed, along with cabal.

cabal update
cabal install --lib HUnit
./build.sh

You can then start the REPL with

./bin/argyle repl

If you wish to run the test suite (recommended), you may run

pip install falderal
./test.sh

Documentation

For the full definition of Argyle, see the Definition of Argyle document, a literal test suite written in [Falderal] format that aims to serve as the specification for the language.

What follows is a more informal introduction.

Lisp is usualy promoted as being homoiconic, but presentations of its homoiconicity often gloss over the following detail: not every valid S-expression is a valid Lisp program. In essence Lisp has two syntaxes, the "low-level syntax" of S-expressions, and the "high-level syntax" of special forms. The traditional treatment is to completely ignore that fact, and allow expressions such as (quote (let 123)) to be perfectly acceptable quoted form, even though (let 123) is not a valid expression -- and to have the argument to eval is a list, even though a list need not contain a valid expression.

Argyle regards this as a shortcoming, and intends to address it. Although they are written in an S-expression syntax, Argyle programs are not parsed into cons lists. More precisely, even if the implementation parses them into cons lists (as the reference implementation does), those cons lists are not directly exposed to the interpreter. Rather, the cons lists go through an extra step of being parsed into Abstract Binding Trees (ABTs), and it is those that are exposed to the interpreter.

And it is ABTs that an Argyle program works with; the argument to eval is not a list, it is an ABT, giving a strong guarantee that it represents a valid program and not some cons-list junk like (let 123).

TODO

  • Continue to clean up ABT helper functions as needed
  • Test that equality operator treats ABTs as alpha-equivalent
  • letrec - implement in code first, eventually look towards making it a macro/sugar, drawing upon Lanthorn
  • Documentation
  • Lariat-style constructors?