Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/larsbrinkhoff/emacs-cl

Common Lisp implemented in Emacs Lisp.
https://github.com/larsbrinkhoff/emacs-cl

common-lisp compiler emacs emacs-lisp interpreter lisp programming-language

Last synced: 3 months ago
JSON representation

Common Lisp implemented in Emacs Lisp.

Lists

README

        

Emacs Common Lisp is an implementation of Common Lisp, written in
Emacs Lisp. It does not yet purport to conform to the ANSI standard
since, among other things, CLOS, and pretty printing are missing.
However, most other Common Lisp features like lexical closures,
packages, readtables, multiple values, bignums, adjustable arrays,
etc, are present. At this stage many bugs remain and error checking
is sparse.

This implementation provides a Common Lisp environment, separate from
Emacs Lisp, running in Emacs. It does not intend to extend Emacs Lisp
with Common Lisp functionality; however, Common Lisp functions compile
to byte code, so Emacs Lisp functions can call Common Lisp functions
and vice versa.

All Emacs Lisp data can be passed unchanged to Common Lisp functions,
except vectors, which are used to implement various Common Lisp types
not present in Emacs Lisp. An Emacs Lisp vector should be converted
to a Common Lisp vector by calling cl-vector.

To convert a Common Lisp vector back to Emacs Lisp, call el-vector.
Common Lisp strings and bit vectors should be converted by el-string
and el-bool-vector or el-bit-vector (depending on your Emacs flavour).

There is a mailing list for discussion about Emacs Common Lisp. Go to
http://mailman.nocrew.org/cgi-bin/mailman/listinfo/emacs-cl to subscribe.

See INSTALL for usage instructions. See HOWTO for some hints on how
to do common tasks.

Some algorithms and messages are from SBCL and Gareth McCaughan.
Notes on the internals of the implementation follows:

Mapping from Emacs Lisp object types to Common Lisp object types:

EL type CL type
bit-vector (XEmacs) simple-bit-vector
bool-vector (GNU Emacs) simple-bit-vector
character (XEmacs) character
compiled-function compiled-function
cons cons
float single-float
hash-table hash-table
integer fixnum
string simple-string
subr compiled-function
symbol symbol
vector various, type in first element

Common Lisp objects represented by Emacs Lisp vectors:

bignum [BIGNUM ...]
ratio [RATIO ]
complex [COMPLEX ]
character [CHARACTER ]
string [STRING ]
char-array [char-array ]
bit-vector [BIT-VECTOR ]
bit-array [bit-array ]
simple-vector [SIMPLE-VECTOR ...]
vector [VECTOR ]
array [ARRAY ]
interpreted-function [INTERPRETED-FUNCTION ]
instance of class C [C ...]

Emacs feature wish list:

* Hash tables. Done in later versions.

* Weak hash tables. Done in later versions.

* A function that returns the address of an object, for implementing
print-unreadable-object :identity t.

* A function that returns the amount of processor time used, for
implementing get-internal-run-time.

* A way to portably embed information in byte-code objects.

There are problems with the cl:function macro when its output appears
in compiled files:

* When applied to a byte-code function the result will be printed
with the #[...] syntax. That works, but separate invokations of
cl:function will result in distinct, though equal, code vectors.

* When's applied to a subr, the result will be printed with the
# syntax, which will raise a syntax error when loaded.

In general, Emacs' byte compiler doesn't preserve object identity,
which is a problem. Here's another case:

* This merges the two distinct strings into one object:
(byte-compile `(lambda () (foo ,(copy-seq "abc") ,(copy-seq "abc"))))