News for hackers. Stuff that matters.
Re:XOS: Build your own operating system by userbinator on Tuesday October 14, 2014 @04:30AM (#8452450)
The machine simulator is known as eXperimental String Machine (XSM). It is an interrupt driven uniprocessor machine. The machine handles data as strings. A string is a sequence of characters terminated by ’\0’. The length of a string is at most 16 characters including ’\0’. Each of these strings is stored in a word. (Refer Section: Memory) The machine interprets a single character also as a string.

What an... odd architecture. Fun for experimentation, I'm sure, but I think it's too different from contemporary CPUs to give a good taste of what the "real" thing is like.

Re:XOS: Build your own operating system by derefr on Tuesday October 14, 2014 @12:25PM (#8454164)
Reminds me of Nock (the abstract machine for Urbit). Nock handles data as either base-two arbitrary-precision integers (i.e. bitstrings) or cons cells. There's no string type or integer type; both are just untagged streams of ones and zeroes. Basically, they're what some languages call "symbols" or "atoms" or "interned strings": where in, say, Erlang you'd have either the atom 'hello' or the list-of-codepoints "hello" or the binary-string <<"hello">>, in Nock the VM would only know that it's holding onto the number 448378203247 (i.e. 0x68656c6c6f—the bitstring ASCII representation of the characters for "hello".)

In Nock, instead of beta reduction privileging certain types (e.g. symbols, closures) as having special meanings at the head of a cons cell, Nock just defines a mapping between integers and functions. Effectively, Nock is a Lisp-2: the f in (f x) and the f in (g f) have different meanings.

In fact, in Nock, both the meaning of the f in (g f), and the meaning of the f in (g (f x)), are entirely determined by g—you could think of this as every Nock function being a hygenic macro, though it's more than that. This seems dangerous, but Nock is supposed to be a "VM target language" only: the source languages that compile to it are left to define their own "platform semantics" by restricting and making guarantees on how arguments to functions in those languages will be evaluated (eagerly/lazily, early/late-bound, pre-beta-reduced like a function or post-beta-reduced like a macro, etc.) They're also left to define dynamic/lexical scoping rules, by leaving the g the responsibility of resolving the f—and the x, if it wants—in (g (f x)).

Re:XOS: Build your own operating system by al2o3cr on Tuesday October 14, 2014 @08:20AM (#8453048)
Yeah, that has me scratching my head as well. Especially once I realized there's no way to index into a string...
Re:XOS: Build your own operating system by TehCorwiz on Tuesday October 14, 2014 @11:26AM (#8453829)
Caveat: I haven't read the spec. But at that level wouldn't you just be doing pointer math to access specific parts of the word?
Re:XOS: Build your own operating system by rthomas6 on Tuesday October 14, 2014 @11:31AM (#8453843)
What would be fun is to design a processor of this architecture in VHDL.
Re:XOS: Build your own operating system by Vendan on Tuesday October 14, 2014 @12:04PM (#8454036)
issue is the simulated "processor" is actually interpreting asm source code on the fly. Direct string parsing on an fpga, including string to int, i.e. "1234" -> 1234, would make it extremely "fun"
Re:XOS: Build your own operating system by blt on Tuesday October 14, 2014 @10:20AM (#8453512)
yeah, I get that it's experimental but I really want to know the motivation for this choice.