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?
Commit History
@9b17cc479c23bf13f34095cd5065af83c5224244
git clone https://git.catseye.tc/Argyle/
- Charge towards alpha-equivalence of ABT values. Chris Pressey 7 months ago
- Add `equal?` built-in predicate. Chris Pressey 7 months ago
- Add `if-apply` built-in function. Chris Pressey 7 months ago
- Place under a 2-clause BSD license. Follow REUSE 3.2 convention. Chris Pressey 7 months ago
- Implement `cons`, `car`, `cdr` in terms of ABT nodes. Chris Pressey 7 months ago
- Add `abt` function, which will (we hope) let us do more with ABTs. Chris Pressey 7 months ago
- Improve names. Chris Pressey 7 months ago
- Expand the cons list attempt and document why it doesn't work. Chris Pressey 7 months ago
- Restore unit tests. Chris Pressey 7 months ago
- Fix multiple-values-let-binding still being created by eval quote. Chris Pressey 7 months ago