033892777a
See issue #587. * Merge eval-ast and eval into a single conditional. * Expand macros during the apply phase, removing lots of duplicate tests, and increasing the overall consistency by allowing the macro to be computed instead of referenced by name (`((defmacro! cond (...)))` is currently illegal for example). * Print "EVAL: $ast" at the top of EVAL if DEBUG-EVAL exists in the MAL environment. * Remove macroexpand and quasiquoteexpand special forms. * Use pattern-matching style in process/step*.txt. Unresolved issues: c.2: unable to reproduce with gcc 11.12.0. elm: the directory is unchanged. groovy: sometimes fail, but not on each rebuild. nasm: fails some new soft tests, but the issue is unreproducible when running the interpreter manually. objpascal: unreproducible with fpc 3.2.2. ocaml: unreproducible with 4.11.1. perl6: unreproducible with rakudo 2021.09. Unrelated changes: Reduce diff betweens steps. Prevent defmacro! from mutating functions: c forth logo miniMAL vb. dart: fix recent errors and warnings ocaml: remove metadata from symbols. Improve the logo implementation. Encapsulate all representation in types.lg and env.lg, unwrap numbers. Replace some manual iterations with logo control structures. Reduce the diff between steps. Use native iteration in env_get and env_map Rewrite the reader with less temporary strings. Reduce the number of temporary lists (for example, reverse iteration with butlast requires O(n^2) allocations). It seems possible to remove a few exceptions: GC settings (Dockerfile), NO_SELF_HOSTING (IMPLS.yml) and step5_EXCLUDES (Makefile.impls) . |
||
---|---|---|
.. | ||
hist | ||
src | ||
tests | ||
Dockerfile | ||
fake-readline.lisp | ||
Makefile | ||
README.org | ||
run | ||
run-abcl.lisp | ||
run-mkcl.lisp | ||
step0_repl.asd | ||
step1_read_print.asd | ||
step2_eval.asd | ||
step3_env.asd | ||
step4_if_fn_do.asd | ||
step5_tco.asd | ||
step6_file.asd | ||
step7_quote.asd | ||
step8_macros.asd | ||
step9_try.asd | ||
stepA_mal.asd |
Implementation of MAL in Common Lisp
Introduction
This is a portable implementation of MAL in Common Lisp. It has been tested to work with following Common Lisp implementations
- Steel Bank Common Lisp http://sbcl.org/
- Clozure Common Lisp http://ccl.clozure.com/
- CMU Common Lisp https://www.cons.org/cmucl/
- GNU CLISP http://www.clisp.org/
- Embeddable Common Lisp https://common-lisp.net/project/ecl/
- ManKai Common Lisp https://common-lisp.net/project/mkcl/
- Allegro CL http://franz.com/products/allegro-common-lisp/
- Armed Bear Common Lisp http://abcl.org/
cl-launch to build executable/wrapper scripts for most of the above implementations.
Dependencies
- cl-launch For building command line executable scripts. See cl-launch
- quicklisp For installing dependencies. See quicklisp
- readline
For readline integration. You can install it on Ubuntu using apt the package
is
libreadline-dev
. If you wish to run the implementation using Allegro CL, you will also have to install the 32 bit version of readline (lib32readline-dev
on Ubuntu) - (Optional) asdf
This is needed if you want to run the implementation using GNU CLISP, since
GNU CLISP does not ship with
asdf
andcl-launch
depends on it. You can install it on Ubuntu using apt the package iscl-asdf
Running using different implementations
By default the MAL is built using sbcl
, you can control this using LISP
environment variable. The variable should be set to the cl-launch "nickname" for
implementation. The nicknames that work currently are
Implementation | Nickname |
Steel Bank Common Lisp | sbcl |
Clozure Common Lisp | ccl |
CMU Common Lisp | cmucl |
GNU CLISP | clisp |
Embeddable Common Lisp | ecl |
ManKai Common Lisp | mkcl |
Allegro CL | allegro |
Armed Bear Common Lisp | abcl |
For example to build with GNU CLISP, you need to do the following
cd common-lisp ; LISP=clisp make
You can control the implementation binary used for the build using environment variables. For a given implementation nickname, the environment variable will be the capitalization of the given nickname.
Implementation | Binary Path |
Steel Bank Common Lisp | SBCL |
Clozure Common Lisp | CCL |
CMU Common Lisp | CMUCL |
GNU CLISP | CLISP |
Embeddable Common Lisp | ECL |
ManKai Common Lisp | MKCL |
Allegro CL | ALLEGRO |
Armed Bear Common Lisp | ABCL |
For example to build MAL with Clozure CL installed in
\~/.roswell/impls/x86-64/linux/ccl-bin/1.11/lx86cl64
, you need to do the
following
cd common-lisp ; LISP=ccl CCL=~/.roswell/impls/x86-64/linux/ccl-bin/1.11/lx86cl64 make
You can use the variables *cl-implementation*
and *cl-version*
can be used
to in MAL REPL to check the Common Lisp implementation and the version used for
building it.
Interop
There is some basic interop in the form cl-eval
which takes a string and
evaluates it as Common Lisp code, the result is returned in form of a MAL value,
as such you are limited to code that produces values that have MAL counterparts.
Known Issues
ABCL takes a long to boot as such it needs to be run with TEST_OPTS
set to
--start-timeout 120