Elang
A Python-like language for the Emacs VM
Install / Use
/learn @vkazanov/ElangREADME
[[https://api.travis-ci.org/vkazanov/elang.svg][file:https://api.travis-ci.org/vkazanov/elang.svg]] [[http://melpa.org/#/elang][file:http://melpa.org/packages/elang-badge.svg]]
-
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?
Install the ~names~ package.
Clone the repository, add the resulting directory to your ~load-path~ and do ~(require 'elang)~.
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.
Check the ~examples/~ directory for code that should work now.
Alternatively, Elang is also available on MELPA (see the ~elang~ package), 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 (~elang-compiler.el~) the parse tree to a byte-compiled Emacs function and executes the latter.
To load a complete file it just parses the file, finding ~def~'s and 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 [[file:TODO.org]] for a list of things currently missing, and don't hesitate to ask questions or offer code improvements!
-
Gotchas
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.
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
