RDF-fuck
This is experiment to make a programming language with RDF graphs like XMLfuck is using XML documents. It is like brainfuck because it is a simple way to do and because XMLfuck does it; later on other extensions can be added to in order to make a different kind of programming language instead.
There is one instruction pointer which points to a node, and a call stack of list of pointer to nodes. There is also the tape which is the standard tape of brainfuck.
The instruction pointer initially points to the node with an edge of type gopher://zzo38computer.org/1ns/meta:primary leading out of it.
In order to execute a node:
- Look for an edge of type http://www.w3.org/1999/02/22-rdf-syntax-ns#first; that tells it what to do.
- Normally, the next node to execute is whatever the http://www.w3.org/1999/02/22-rdf-syntax-ns#rest of that node leads to.
The possible commands are:
- http://esolangs.org/wiki/RDF-fuck#inc increments the value on the tape.
- http://esolangs.org/wiki/RDF-fuck#dec decrements the value on the tape.
- http://esolangs.org/wiki/RDF-fuck#ptrinc increments the tape pointer.
- http://esolangs.org/wiki/RDF-fuck#ptrdec decrements the tape pointer.
- http://esolangs.org/wiki/RDF-fuck#read inputs a byte.
- http://esolangs.org/wiki/RDF-fuck#print outputs a byte.
- A node that has a http://www.w3.org/1999/02/22-rdf-syntax-ns#first from it is a loop: If the value at the tape pointer is nonzero, instead of going to next, push current instruction pointer to stack, go to this node and execute from here.
- http://esolangs.org/wiki/RDF-fuck#exit is used to exit a loop or the program, by popping from the call stack to determine what to execute next, instead of going to the next node normally. (This will be the node for the loop, in case of a loop; therefore it will try to execute it again.)
There is one built-in triple <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://esolangs.org/wiki/RDF-fuck#exit>. Adding it explicitly to your program is redundant.
Example
@prefix : <http://esolangs.org/wiki/RDF-fuck#>. (:read (:print :read)) <gopher://zzo38computer.org/1ns/meta:primary> [].