git @ Cat's Eye Technologies Arboretuum / e959f82
Convert documentation to Markdown. Cat's Eye Technologies 10 years ago
8 changed file(s) with 92 addition(s) and 108 deletion(s). Raw diff Collapse all Expand all
0 The Arboretuum Programming Language
1 ===================================
2
3 March 2008, Chris Pressey, Cat's Eye Technologies.
4
5 Description
6 -----------
7
8 Arboretuum is a language based on an experimental variant of
9 tree-rewriting which we call forest-rewriting. Appropriate to its name,
10 during forest-rewriting, multiple trees (specifically, a finite set) are
11 rewritten. Each tree is labelled with a name; a rewriting pattern can
12 refer to multiple trees, and must match all of them simultaneously in
13 order for a replacement to occur.
14
15 As an experiment, Arboretuum was not entirely a success.
16 Forest-rewriting unfortunately turned out to be insufficient for what I
17 wanted to apply it to, namely compiler specification. The idea was to
18 have each tree associated with some data structure used in the
19 compilation process (AST, symbol table, output buffer, etc.) However, it
20 became apparent that, by itself, forest-rewriting could not synchronize
21 the data across the trees the way it would need to be synchronized in a
22 real compiler. I plan to tackle the problem again, with a different
23 variation on rewriting, in a future project.
24
25 Regardless, Arboretuum is Turing-complete, as tree-rewriting is simply a
26 special case of forest-rewriting: just have one tree in the forest.
27
28 Implementation
29 --------------
30
31 I will refer you to the reference implementation of Arboretuum for
32 details on the semantics of the language. Ordinarily I frown upon this
33 sort of practice — normatively defining a language by an implementation
34 rather than by a specification — but the interests of brevity, the
35 experimental tack of the project, the unsuccessful outcome of the
36 experiment, and the relative well-definedness of the implementation
37 language (the purely functional subset of R5RS Scheme) conspire to
38 make the consequences of this choice less painful than usual.
39
40 The reference implementation comprises the following files:
41
42 - `preprocess.scm`
43
44 Pre-processes the input program into an internal format suitable for
45 forest-rewriting.
46
47 - `unify.scm`
48
49 Implementation of the unification algorithm which is used to match
50 the pattern part of rewriting rules to the forest.
51
52 - `forest-rewrite.scm`
53
54 Implements the forest-rewriting process proper.
55
56 - `utils.scm`
57
58 Miscellanous support procedures, including `mergesort`,
59 `vector-store` (a side-effect-free alternative to `vector-set!`),
60 `print` and `test`.
61
62 In addition, the following supplementary files which are not definitive
63 w.r.t. the Arboretuum language are included in the project:
64
65 - `tests.scm`
66
67 Gives a set of unit tests to confirm the absence of certain
68 erroneous behaviours. (Obviously, no number of unit tests could
69 confirm the absence of *errors*...)
70
71 - `tree-rewrite.scm`
72
73 Some basic tree-rewriting code, to provide contrast between it's
74 complexity and that of forest rewriting.
75
76 Note that the Scheme implementation of algorithms in the above files are
77 to be taken as *pedantic* rather than *efficient*. They are meant to be
78 read (perhaps even enjoyed?) and only incidentally to be executed.
79
80 History
81 -------
82
83 This project was begun in January 2006. I'd been meaning to release it
84 for a while before actually doing so in March of 2008.
85
86 Happy forest-rewriting!
87
88 -Chris Pressey
89 Cat's Eye Technologies
90 March 4, 2008
91 Chicago, Illinois, USA
+0
-108
doc/arboretuum.html less more
0 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1 <!-- encoding: UTF-8 -->
2 <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <title>The Arboretuum Programming Language</title>
6 <!-- begin html doc dynamic markup -->
7 <script type="text/javascript" src="/contrib/jquery-1.6.4.min.js"></script>
8 <script type="text/javascript" src="/scripts/documentation.js"></script>
9 <!-- end html doc dynamic markup -->
10 </head>
11 <body>
12
13 <h1>The Arboretuum Programming Language</h1>
14
15 <p>March 2008, Chris Pressey, Cat's Eye Technologies.</p>
16
17 <h2>Description</h2>
18
19 <p><dfn>Arboretuum</dfn> is a language based on an experimental variant of
20 tree-rewriting which we call <dfn>forest-rewriting</dfn>. Appropriate to its name, during
21 forest-rewriting, multiple trees (specifically, a finite set) are rewritten.
22 Each tree is labelled with a name; a rewriting pattern can refer to multiple trees,
23 and must match all of them simultaneously in order for a replacement to occur.</p>
24
25 <p>As an experiment, Arboretuum was not entirely a success. Forest-rewriting unfortunately turned out to
26 be insufficient for what I wanted to apply it to, namely compiler specification. The idea
27 was to have each tree associated with some data structure used in the compilation process
28 (AST, symbol table, output buffer, etc.) However, it became apparent that, by itself,
29 forest-rewriting could not synchronize the data across the trees the way it would need
30 to be synchronized in a real compiler. I plan to tackle the problem again, with a different variation
31 on rewriting, in a future project.</p>
32
33 <p>Regardless, Arboretuum is Turing-complete, as tree-rewriting is simply a special
34 case of forest-rewriting: just have one tree in the forest.</p>
35
36 <h2>Implementation</h2>
37
38 <p>I will refer you to the reference implementation of Arboretuum
39 for details on the semantics of the language. Ordinarily I frown upon this
40 sort of practice — normatively defining a language by an implementation
41 rather than by a specification — but the interests of brevity, the experimental tack of the
42 project, the unsuccessful outcome of the experiment, and the relative
43 well-definedness of the implementation language (the purely functional subset of R<sup>5</sup>RS Scheme) conspire
44 to make the consequences of this choice less painful than usual.</p>
45
46 <p>The reference implementation comprises the following files:</p>
47
48 <ul>
49
50 <li><code>preprocess.scm</code>
51 <p>Pre-processes the input program into an internal format
52 suitable for forest-rewriting.
53 </p></li>
54
55 <li><code>unify.scm</code>
56 <p>Implementation of the unification algorithm which is used to match
57 the pattern part of rewriting rules to the forest.
58 </p></li>
59
60 <li><code>forest-rewrite.scm</code>
61 <p>Implements the forest-rewriting process proper.
62 </p></li>
63
64 <li><code>utils.scm</code>
65 <p>Miscellanous support procedures, including <code>mergesort</code>,
66 <code>vector-store</code> (a side-effect-free alternative to <code>vector-set!</code>),
67 <code>print</code> and <code>test</code>.
68 </p></li>
69
70 </ul>
71
72 <p>In addition, the following supplementary files which are not definitive
73 w.r.t. the Arboretuum language are included in the project:</p>
74
75 <ul>
76
77 <li><code>tests.scm</code>
78 <p>Gives a set of unit tests to confirm the absence of certain erroneous behaviours.
79 (Obviously, no number of unit tests could confirm the absence of <em>errors</em>...)
80 </p></li>
81
82 <li><code>tree-rewrite.scm</code>
83 <p>Some basic tree-rewriting code, to provide contrast between it's complexity
84 and that of forest rewriting.</p></li>
85
86 </ul>
87
88 <p>Note that the Scheme implementation of algorithms in the above files are
89 to be taken as <em>pedantic</em> rather than <em>efficient</em>.
90 They are meant to be read (perhaps even enjoyed?) and only incidentally
91 to be executed.</p>
92
93 <h2>History</h2>
94
95 <p>This project was begun in January 2006. I'd been meaning to release
96 it for a while before actually doing so in March of 2008.</p>
97
98 <p>Happy forest-rewriting!</p>
99
100 <p>-Chris Pressey
101 <br/>Cat's Eye Technologies
102 <br/>March 4, 2008
103 <br/>Chicago, Illinois, USA</p>
104
105
106 </body>
107 </html>
(No changes)
(No changes)
(No changes)
(No changes)
(No changes)