SkillAgentSearch skills...

Elang

A Python-like language for the Emacs VM

Install / Use

/learn @vkazanov/Elang
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

[[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:

  1. This is not Python. This is not even a port of the language. Technically this is Emacs Lisp using basic Python syntax ideas.

  2. The language uses dynamic binding.

  3. 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.

  4. No list or map-related syntax.

Related Skills

View on GitHub
GitHub Stars49
CategoryDevelopment
Updated1y ago
Forks1

Languages

Emacs Lisp

Security Score

75/100

Audited on Jul 4, 2024

No findings