Files
gzz-mirror/Documentation/Clang_Design/thales.wml
2026-09-14 20:19:29 -04:00

188 lines
5.9 KiB
HTML

# -*- HTML -*-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!--
NOTE! This file uses WML 2.0.1
PLEASE PLEASE PLEASE don't edit .HTML. Edit .WML!!!! Actually,
it's more important for you since your changes will be LOST FOREVER
if you edit the .HTML files.
-->
# FIXME
<define-tag zztitle endtag=required>
<title>%body</title>
<h1>%body</h1>
</define-tag>
<define-tag zh2 endtag=required>
<h2>%body</h2>
</define-tag>
<define-tag zh3 endtag=required>
<h3>%body</h3>
</define-tag>
#include '../wmlinc/article.wml'
<zztitle>Thales Clang Draft Spec</zztitle>
<pre>$Id: thales.wml,v 1.4 2000/09/07 12:34:24 ajk Exp $</pre>
<grid layout=3x3 spacing=20>
<cell> <b>Antti-Juhani Kaijanaho</b> <br>
<code>gaia@iki.fi</code><br>
Dept. of Mathematical Information Technology <br>
University of Jyväskylä
</cell>
</grid>
<p>
WARNING! This document is <strong>extremely unstable</strong>. You
should not depend on any of it to remain as it is.
</p>
<zh2>Introduction</zh2>
<p>
<zh2>The ZigZag Structure</zh2>
<p>
<p>
The ZigZag structure consists of cells, cell content and connections
between cells along dimensions. Each cell has content (either a
string or a span), and cells are connected along dimensions.
Dimensions have unique names. Dimensions have two directions: the
positive direction and the negative direction. A cell may have at
most one connection along a dimension on a direction. The term
<dfn>posward</dfn> means the positive direction and the term
<dfn>negward</dfn> means the negative direction; in English text they are
used analoguously to such terms as rightward and upward. A particular
instance of the ZigZag structure is called a ZigZag space.
</p>
<zh2>Cell references in ZigZag: the cursor mechanism</zh2>
<p>
<zh2>Thales Clang Syntax</zh2>
<p>
Thales Clang has six syntactic forms: <dfn>cell literals</dfn>,
<dfn>primitives</dfn>, <dfn>cell denoters</dfn>, <dfn>applications</dfn>,
<dfn>sequences</dfn> and <dfn>abstractions</dfn>. Instances of these
syntactic forms are called <dfn>expressions</dfn>.
</p>
<p>
All expressions have an <dfn>identity cell</dfn>, a cell that denotes the
expression as a whole. The identity cell of all expression is a
member of a rank along the dimension d.thales-syntactic-form.
The headcell of that dimension determines the syntactic form of the
expression. An expression can incorporate another expression as a
subexpression by incorporating in its structure a clone of the
subexpression's identity cell.
</p>
<zh3>Cell literals</zh3>
<p>
A cell literal is a cell that statically represents a cell. It is its
own identity cell. The cell literal refers to the cell in the
structure that it represents, using the cursor mechanism.
</p>
<zh3>Primitives</zh3>
<p>
A primitive is a cell that represents a primitive operation
implemented outside Thales Clang. It is its own identity cell.
</p>
<p>
Primitive cells are mapped to their implementations using the
following mechanism. From the home cell, a rank along
d.thales-primitives enumerates all known primitives. Each
primitive cell is connected posward along
d.thales-primitive-binding to a cell whose content is a magic
cookie (a string) used to identify the primitive.
</p>
<zh3>Cell denoters</zh3>
<p>
A cell denoter is a cell that dynamically represents a cell. It is
its own identity cell. It is an error for a non-clone cell denoter to
appear as a subexpression outside the abstraction parameter list (see
section~<!--\ref{ssec:abstraction}-->).
</p>
<zh3>Applications</zh3>
<p>
An application expression is a rank of cells along
d.thales-application. The cells in that rank must be identity cells
or clones of identity cells. The identity cell of this expression is
the headcell of the rank. The headcell of the rank must be a clone of
the identity cell of either a primitive expression or an abstraction
expression.
</p>
<zh3>Sequences</zh3>
<p>
A sequence expression is a rank of cells along
d.thales-sequence. Its identity cell is the headcell of that
rank, and the rest of the cells must be clones of identity cells of
identity cells or identity cells of application expressions.
</p>
<zh3>Abstractions</zh3><!--\label{ssec:abstraction}-->
<p>
An abstraction expression is a subspace generated by the expression
identity cell with respect to the dimensions
d.thales-sequence and d.thales-application.
</p>
<p>
The rank along d.thales-application from the identity cell
excluding the identity cell itself and the posend cell of the rank
contains a list of formal parameters for this abstraction. The posend
cell of the rank must be an identity cell of another expression, known
as the <dfn>body</dfn> of the abstraction.
</p>
<zh2>Informal semantics</zh2>
<p>
The mechanism by which an application expression whose identity cell
is a clone of a primitive is evaluated is implementation-defined.
</p>
<p>
An application expression whose identity cell is a clone of the
identity cell of an abstraction is evaluated as follows:
</p>
<p>
The subexpression denoted by the headcell of the expression rank is
evaluated. The resulting value will be an abstraction. A fresh
environment is created with exactly as many positional slots as the
abstraction value has parameters and one ``inherited environment''
slot. The environment captured by the resulting abstraction value is
bound to the ``inherited environment'' slot of the fresh environment.
The rest of the cells in the application rank are evaluated in
negative-to-positive order and the results are bound to the
corresponding positional slots. A fresh activation record is created,
and the fresh environment is bound to its environment slot. The
current active activation record is bound to the fresh AR's saved AR
slot. The fresh AR is made current active AR. The body of the
abstraction is now evaluated. The AR in the current active AR's saved
AR slot is made current active AR. The result of this evaluation is
the result value of the body.
</p>
<!--
vim: set syntax=html :
-->