What is Elang?
Elang is a a Python-like language for the Emacs VM.
It is a Frankenstein’s monster, created using a ported Python tokenizer, a Python subset parser and a compiler which emits Emacs VM byte-code.
How to play with it?
Clone the repository, add the resulting directory to your
load-path and do
Then open one of the example files in the
examples/ directory and do, say,
(elang-eval-current-defun) while having the point somewhere within one of
the test functions there.
The function should become available through
M-: or any other means of running Emacs Lisp functions.
examples/ directory for code that should work now.
Alternatively, Elang is also available on MELPA (see the
although I still recommend doing it manually.
How does it work?
What do you think? It tokenizes (see
elang-tokenizer.el) the code, parses
elang-parser.el) the token stream, then compiles (
parse tree to a byte-compiled Emacs function and executes the latter.
To load a complete file it just parses the file, finding
global assignments, loading the functions and setting global variables.
Note that global assignments currently do not evaluate it’s values.
Who needs such a beast?
In it’s current state - nobody, as there’s just too much to do for me. This is something I created just to see if Emacs VM can be a target for a language different from Lisps. And it turns out it can..! I believe this prototype can be turned into something quite useful, or interesting at least.
So see TODO.org for a list of things currently missing, and don’t hesitate to ask questions or offer code improvements!
Actually, only the most basic things currently work, i.e. expressions and funcalls. Things to remember additionally:
- This is not Python. This is not even a port of the language. Technically this is Emacs Lisp using basic Python syntax ideas.
- The language uses dynamic binding.
- The language does not interoperate with Emacs Lisp in a nice way, i.e. there’s no was to deal with symbols, or declare an interactive function.
- No list or map-related syntax.