Command line
What it is
A terminal program with the machine inside it, that reads lines and
prints what they answer; the easiest host to start with. It loads its
modules at run time. The repository is o.se.
Get it running
In the workspace:
cd hosts/unix.o.se && make
As a standalone clone:
git clone --recursive https://github.com/asomadev/o.se
cd o.se && make
Prebuilt binaries: github.com/asomadev/o.se/releases.
First program
Start a prompt and type a line:
./o.se -f o.se.osen/osen.ose
> (21, 2) /o/add
: 23
./o.se -f repl.ose is the same prompt without osen loaded: it reads
the instruction language only.
What it adds
Into the host register, as /o/ verbs a program calls like the
language’s own:
/o/udp/sock/create—() -> a new socket, as an int/o/udp/sock/bind—("host", port) -> a new socket bound to them/o/udp/sendto—(data, "host", port) or (data, "host", port, socket) -> nothing; the data sent as one datagram. Without a socket the process’s own is used; a bundle travels as its bytes, a blob as it is./o/udp/send—(data, socket) -> nothing; the data sent on a connected socket/o/udp/recv—(socket) -> the next datagram, as an element, and /udp/sender/addr : "host". Waits until one arrives./o/udp/receive—(callback list, port) -> nothing; the list runs when a datagram arrives on the port./o/listenis the same with a port and a function./o/udp/close—(socket) -> nothing; the socket closed/o/time/now—() -> the time now, as a timetag/o/load—("path") -> nothing; the file loaded: a.osefile as instructions, anything else parsed as osen and run./o/lines/read—("path") -> a bundle of the file's lines, as strings/o/string/fromfile/read—("path") -> the file's contents as a blob, ending in a zero byte/o/quit—() -> nothing; the process ends/o/hook/parse/pre,/o/hook/parse/post—(x) -> x; the prompt runs them before and after parsing a line, and a program rebinds one to intercept./o/machine/run—(machine) -> the machine after running, a copy; the original is untouched./o/machine/send—(machine, "host:port") -> nothing; a copy of the machine sent there to resume. The machine stays bound here; what the far end does with an arrival is its own receiver’s choice./o/machine/use/value—(machine, value) -> the machine after continuing with the value in place of the name it could not find. One read; a second read of the same name faults again./o/machine/store/value—(machine, value) -> the machine after binding the name it could not find to the value and continuing. The binding lasts until the frame that faulted returns;/o/machine/bindmakes it outlast that.
A halted machine comes from the prompt: with /!/inner/trap installed, a
line that faults is held as /m, and the four /o/machine/ verbs and the
language’s /o/frames, /o/backtrace, /o/frame, /o/db and
/o/machine/bind take it from there.
And as instructions: the same UDP under /udp/*, /time/now, files and
streams (/read, /readlines, /write, /load, /stdin, /stdout,
/stderr), the shell (/system), a debugger (/debug), an inner
machine (/inner/*) and a run queue.