Python
What it is
A CPython extension: import ose, vm = ose.VM(), and the machine is in
the process. vm.eval runs osen, vm.exec runs instructions, vm.recv
takes bytes off a socket, vm.parse turns source into the bundle that is
the program without running it. The same repository, osepy, holds the
other direction — o.se.python, a module that lets the machine call
Python.
Get it running
Needs a C compiler, git, and Python 3 with its headers, which the
Python from python.org, Homebrew or pyenv has.
git clone --recursive https://github.com/asomadev/osepy
cd osepy/host && make
make builds the extension in place, so import ose works in this
directory; pip install . instead puts it where every Python finds it.
Inside a clone of the asoma workspace, the same host is osepy.
You have it when a machine answers:
>>> import ose
>>> ose.VM().eval('(21, 2) /o/add')
': 23\n'
First program
python3 -m ose.repl is the same machine at a prompt:
ose> (21, 2) /o/add
: 23
In a script, vm = ose.VM(), then vm.eval with a string of osen.
vm.tick() runs what is due in the machine’s queue and returns what it
printed, as vm.eval does: a loop started with ({ body }, ms, "/name")
/continue/every runs a period each time the loop is due, one loop per
name, and carries its accumulator from one tick to the next.
What it adds
Python objects, by name: vm.bind("/py/reverse", f) puts a Python
function in the host register, callable from any bundle that reaches the
machine, and python3 -m ose.repl --load udp.py makes every function in
an ordinary Python file an address.
And the osen reference as data: the prompt’s machine
has the register /_q, one entry per name, so vm.eval("/_q/o/add")
answers /o/add’s entry.