Hello.
I've just released Python version of Shen[1] which is a showcase of my
KLVM translator. In current state Shen-py is huge and unbearably slow.
Also keep in mind that I haven't written Python before. But it seems to
work.
Running
-------
Go to directory where `shen.py` is and type
python -m shen
If you imported shen module from Python repl you can start Shen repl via
shen.repl()
Python integration
------------------
To define a Shen function from Python use shen.defun construct:
shen.defun("plus", 2, lambda: shen.reg[1] + shen.reg[2])
where first argument is the function's name, second is the number of
arguments, and third is a function that takes zero arguments. In that
function passed arguments are accessed via shen.reg array.
To load Python file from Shen use `shenpy.load` function.
About KLVM Translator
---------------------
It translates KL to a some VM language suitable for further translation
to target languages. It takes care of
- TCO,
- lambdas,
- closures,
- exception handling,
- partial application.
So it needs just GC, vectors, function pointers and eval (till I finish
KLVM evaluator) in target language. Also, it's relatively simple to add
green threads support.
1.
https://github.com/gravicappa/shen-py