From 92ff13627021a5fdd4eea59bd5db493cbea5406b Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 7 Aug 2017 12:20:36 +1000 Subject: I think I've finally struck the right width balance --- project/templates/fltkada.html | 2 ++ project/templates/grasp.html | 2 ++ project/templates/sunset.html | 2 ++ project/templates/thue2a.html | 13 ++++++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'project/templates') diff --git a/project/templates/fltkada.html b/project/templates/fltkada.html index cea8cac..a6663e6 100644 --- a/project/templates/fltkada.html +++ b/project/templates/fltkada.html @@ -29,6 +29,7 @@ the interface to C, then importing that to Ada. Attempted usage of the internal on its own is not supported.

A typical FLTK Hello World program in Ada:

+
with FLTK.Widgets.Groups.Windows, @@ -51,6 +52,7 @@ begin end Hello_World; +

Aside from reworking the types to better fit the strongly typed philosophy of Ada, the entire library has been structured to avoid explicit heap usage. As you can see from the above example, the intended use is to diff --git a/project/templates/grasp.html b/project/templates/grasp.html index bf6f79b..45661af 100644 --- a/project/templates/grasp.html +++ b/project/templates/grasp.html @@ -53,6 +53,7 @@ as well as relatively easy conversion to a graph image. If a format that more re comprehensible graph image is found, a parser for it may be added.

The above example is recorded as follows:

+
digraph { 1 [label="puts"] @@ -63,6 +64,7 @@ digraph { 1 -> 3 [label="in"] } +

Source code is available here.

diff --git a/project/templates/sunset.html b/project/templates/sunset.html index 042e936..01420d5 100644 --- a/project/templates/sunset.html +++ b/project/templates/sunset.html @@ -28,6 +28,7 @@ appears: a simple weak copyleft license which places older parts of a work under domain disclaimer in a reasonable timeframe.

The full text is as follows:

+
 SUNSET LICENSE
 Version 1.0, June 2017
@@ -50,6 +51,7 @@ other work.
 a part of this work, then that part is placed into the public domain and you
 may do whatever you want with it, regardless of all other clauses.
 
+

The license file, accompanying detailed rationale, and a simple logo I threw together can all be found in this repo.

diff --git a/project/templates/thue2a.html b/project/templates/thue2a.html index 6cb4680..4f82ed8 100644 --- a/project/templates/thue2a.html +++ b/project/templates/thue2a.html @@ -19,6 +19,7 @@ state of the program. Applicable rules are then applied to the inital state in a order until no more are applicable, at which point the program terminates.

An example Thue program that increments a binary number surrounded by '_' characters:

+
1_::=1++ 0_::=1 @@ -29,6 +30,7 @@ _1++::=10 ::= _1111111_ +

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.

@@ -37,11 +39,13 @@ ended by a blank rule. Note that whitespace in rules and the inital state is NOT go to stdout and the replacement in the program to be the empty string.

The traditional Hello World program:

+
a::=~Hello World! ::= a +

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 @@ -49,11 +53,13 @@ immediately causes problems.

The following is an innocent piece of code that accepts a single line of input and does nothing more. Maybe.

+
a::=::: ::= a +

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 @@ -65,16 +71,21 @@ ordinary symbols. Rules can refer to and manipulate symbols obtained through std surrounding them in double quotes.

A rule that replaces an ordinary symbol 'a' with 'abc':

+
a::=abc +

A rule that replaces the letter 'a' that was obtained from stdin with 'abc':

+
"a"::=abc +

For convenience, a number of escaped characters are also available:

+
 \\ -> backslash
 \r -> return
@@ -83,7 +94,7 @@ a::=abc
 \" -> double quote
 \EOT -> end of file
 
- +

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 -- cgit