summaryrefslogtreecommitdiff
path: root/project/templates/grasp.html
diff options
context:
space:
mode:
Diffstat (limited to 'project/templates/grasp.html')
-rw-r--r--project/templates/grasp.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/project/templates/grasp.html b/project/templates/grasp.html
new file mode 100644
index 0000000..e591d92
--- /dev/null
+++ b/project/templates/grasp.html
@@ -0,0 +1,70 @@
+
+{% extends "base.html" %}
+
+
+
+{% block title %}Grasp Interpreter{% endblock %}
+
+
+
+{% block content %}
+
+<h4>Grasp Interpreter</h4>
+
+<p>Like Lisp, the esoteric programming language <a href="http://esolangs.org/wiki/Grasp">Grasp</a>
+is a homoiconic language that exclusively uses a single datatype. Except instead of lists, it uses
+directed graphs.</p>
+
+<p>A Grasp program is initialised with instruction pointers to those nodes in the graph that have
+a "name" edge to a node with the value "grasp:main". The nodes at each instruction pointer are
+evaluated and the pointer then updated by following an available "next" edge. This continues until
+all instruction pointers have no more "next" edges to follow.</p>
+
+<figure>
+ <img src="/img/grasp_helloworld.png"
+ alt="Hello World in Grasp"
+ height="176"
+ width="268">
+ <figcaption>Hello World in Grasp</figcaption>
+</figure>
+
+<p>In the <a href="https://github.com/fis/grajsp/wiki/Grasp-specification">current specification</a>,
+the actions that can be performed are:</p>
+
+<ul>
+ <li>add or delete an edge</li>
+ <li>change the value of a node</li>
+ <li>add, subtract, multiply, divide, or modulo node values</li>
+ <li>call and return from functions, which take the form of subgraphs with named entry points</li>
+ <li>read and write from arbitrary file handles</li>
+ <li>push, pop and pick a section of nodes arranged to act as a stack</li>
+</ul>
+
+<p>The execution of a node may be skipped by having "cond" edges pointing to either zero values or
+non-numeric values. Also, due to the way instruction pointers update and the way several instructions
+are defined, there is a measure of non-determinism that can be introduced depending on what
+edges are available.</p>
+
+<p>The language seemed like an interesting enough idea, but unfortunately nobody had done anything
+with it, and there was only a specification. This has now been fixed. The interpreter currently
+uses a subset of the DOT graph description language for the file format, to enable a text format
+as well as relatively easy conversion to a graph image. If a format that more readily converts to a
+comprehensible graph image is found, a parser for it may be added.</p>
+
+<p>The above example is recorded as follows:
+<code>
+ digraph {
+ 1 [label="puts"]
+ 2 [label="grasp:main"]
+ 3 [label="Hello world!"]
+
+ 1 -> 2 [label="name"]
+ 1 -> 3 [label="in"]
+ }
+</code>
+</p>
+
+<p>Source code is available <a href="https://github.com/jedb/esoteric">here</a>.</p>
+
+{% endblock %}
+