summaryrefslogtreecommitdiff
path: root/project/templates/thue2a.html
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-06-29 18:42:47 +1000
committerJed Barber <jjbarber@y7mail.com>2017-06-29 18:42:47 +1000
commit931b27a04a5af60f297dd66288fd6163c277b181 (patch)
tree8c3afdab9ec09a9e287e2851cd3143cf31b036bf /project/templates/thue2a.html
parent425785e6fc15bba19cf97a84030bc046e71cbc35 (diff)
Reworked css for nav, pre, code tags, added some colour
Diffstat (limited to 'project/templates/thue2a.html')
-rw-r--r--project/templates/thue2a.html63
1 files changed, 29 insertions, 34 deletions
diff --git a/project/templates/thue2a.html b/project/templates/thue2a.html
index f4dac4f..6cb4680 100644
--- a/project/templates/thue2a.html
+++ b/project/templates/thue2a.html
@@ -18,18 +18,17 @@ a sequence of symbols to replace and a sequence of symbols to replace with, and
state of the program. Applicable rules are then applied to the inital state in a random
order until no more are applicable, at which point the program terminates.</p>
-<p>An example Thue program that increments a binary number surrounded by '_' characters:
+<p>An example Thue program that increments a binary number surrounded by '_' characters:</p>
<code>
- 1_::=1++
- 0_::=1
- 01++::=10
- 11++::=1++0
- _0::=_
- _1++::=10
- ::=
- _1111111_
+1_::=1++
+0_::=1
+01++::=10
+11++::=1++0
+_0::=_
+_1++::=10
+::=
+_1111111_
</code>
-</p>
<p>The before and after symbols in each rule are separated by '::=' and the list of rules is
ended by a blank rule. Note that whitespace in rules and the inital state is NOT ignored.</p>
@@ -37,26 +36,24 @@ ended by a blank rule. Note that whitespace in rules and the inital state is NOT
<p>Output is handled by prefixing the right hand side with '~', which causes those symbols to
go to stdout and the replacement in the program to be the empty string.</p>
-<p>The traditional Hello World program:
+<p>The traditional Hello World program:</p>
<code>
- a::=~Hello World!
- ::=
- a
+a::=~Hello World!
+::=
+a
</code>
-</p>
<p>Input is handled by having the right hand side of a rule be ':::', which causes the left
hand side symbols to be replaced with a line from the standard output. Unfortunately, this
immediately causes problems.</p>
<p>The following is an innocent piece of code that accepts a single line of input and does nothing
-more. Maybe.
+more. Maybe.</p>
<code>
- a::=:::
- ::=
- a
+a::=:::
+::=
+a
</code>
-</p>
<p>If a string involving the letter 'a' is entered into the above program, the single input rule
will again become applicable and another line of input will be obtained. In other words, the
@@ -67,28 +64,26 @@ version 2a. In this version, all symbols obtained through stdin are treated as d
ordinary symbols. Rules can refer to and manipulate symbols obtained through stdin by
surrounding them in double quotes.</p>
-<p>A rule that replaces an ordinary symbol 'a' with 'abc':
+<p>A rule that replaces an ordinary symbol 'a' with 'abc':</p>
<code>
- a::=abc
+a::=abc
</code>
-</p>
-<p>A rule that replaces the letter 'a' that was obtained from stdin with 'abc':
+<p>A rule that replaces the letter 'a' that was obtained from stdin with 'abc':</p>
<code>
- "a"::=abc
+"a"::=abc
</code>
-</p>
-<p>For convenience, a number of escaped characters are also available:
+<p>For convenience, a number of escaped characters are also available:</p>
<pre>
- \\ -> backslash
- \r -> return
- \n -> newline
- \: -> colon
- \" -> double quote
- \EOT -> end of file
+\\ -> backslash
+\r -> return
+\n -> newline
+\: -> colon
+\" -> double quote
+\EOT -> end of file
</pre>
-</p>
+
<p>While this doesn't solve all the problems Thue has (try writing a Thue program that asks
for and greets the user by name!) it should solve this one particular issue. Source code is