1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 17:47:53 +03:00
mal/common-lisp
Nicolas Boulenguez e6d41de4d5 load-file: accept empty file or final comment, return nil
Let `load-file` append a new line in case last line contains a
comment.

Also append `nil` so that the return value is predictible. Remove the
existing explicit `nil` from existing sources.

Adapt documentation and tests.
2019-07-28 13:08:05 +02:00
..
hist Common Lisp: Keep track of the implementation used to build a step 2016-11-18 18:11:20 +05:30
src load-file: accept empty file or final comment, return nil 2019-07-28 13:08:05 +02:00
tests Common Lisp: Implement step A 2016-11-18 17:59:27 +05:30
Dockerfile Common Lisp: Add Dockerfile for Common Lisp implementation 2016-11-18 18:11:17 +05:30
fake-readline.lisp Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
Makefile Convert to loccount based stats calculation. 2019-03-20 23:34:21 -05:00
README.org Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
run Common Lisp: Implement step 0 2016-11-18 17:59:27 +05:30
run-abcl.lisp Common Lisp: Add support for running on ABCL 2016-11-21 01:23:18 +05:30
run-mkcl.lisp Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step0_repl.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step1_read_print.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step2_eval.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step3_env.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step4_if_fn_do.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step5_tco.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step6_file.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step7_quote.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step8_macros.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
step9_try.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30
stepA_mal.asd Common Lisp: Add support for running MAL using MKCL 2017-08-26 15:01:10 +05:30

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

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 and cl-launch depends on it. You can install it on Ubuntu using apt the package is cl-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