12

Emacs implements an interpreter for elisp in C which serves as the de facto reference implementation. Are there any other implementations of elisp in other languages (particularly Javascript)? What is a minimal set of primitives necessary to fully reimplement elisp? What are the essential difficulties in doing so (e.g. dynamic scoping)?

Paul Miller
  • 301
  • 1
  • 4
  • A good starting point would be: http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours

    Although scheme and elisp have their differences, I think the above is a good start to understand the fundamental stuff needed.

    – Renan Ranelli Nov 04 '14 at 16:51

2 Answers2

5

Guile Emacs is an Emacs implementation where the original Emacs Lisp interpreter was replaced by libguile recently. There are still interoperation issues (Guile and Emacs have different ideas about strings for instance), but existing Emacs Lisp code can already used (though with rather intimidating performance regressions).

Alternatively, there's nicferrier's Ejit. Its README does describe the difficulties involved, such as certain things only making context in Emacs and how a minimal set of primitives is chosen before compiling Emacs Lisp to Javascript. It is therefore not really a reimplementation, but might help answering your latter questions.

wasamasa
  • 22,178
  • 1
  • 66
  • 99
  • Just a note: Ejit compiles to JS, it isn't written in JS. – Malabarba Nov 04 '14 at 18:07
  • Yeah, that paragraph was intended as response to the question what the minimal set of primitives is since the intention is to recognize and simplify those as much as possible before compiling to JS. Some of the difficulties (like, buffers and their properties making less sense) are described, too. – wasamasa Nov 04 '14 at 18:27
  • 2
    I think you want to be pointing to Guile itself. The Guile Emacs project, whilst a significant use-case, is more of a side-note here. – phils Nov 04 '14 at 19:29
2

I barely remember writing it but I started exploring it in https://github.com/samsonjs/elisp.js

Sami Samhuri
  • 121
  • 1