repos
/
cl-unification
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Copyright updated.
Annotate for file docs/html/templates.html
2004-11-17 mantoniotti
1
<html>
22:19:54 '
2
<head>
'
3
<title>CL Unification Templates</title>
'
4
<link rel="stylesheet" href="main.css">
'
5
</head>
'
6
'
7
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" bgcolor="#ffffff">
'
8
'
9
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" vspace="0" hspace="0">
'
10
<tr>
'
11
<td colspan="3">
'
12
<div class="header"
'
13
style="font-family:=Verdana,Arial,Helvetica; font-size: 18px; color: #41286f;">
'
14
<strong><i>CL Extensions: UNIFICATION TEMPLATES</i><string>
'
15
<div class="navigation">
'
16
<a href="index.html" class="navigation-link-selected">Home</a>
'
17
| <a href="downloads.html" class="navigation-link">Downloads</a>
'
18
| <a href="links.html" class="navigation-link">Links</a>
'
19
</div>
'
20
</div>
'
21
<div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
'
22
<div class="middle-bar"><img src="images/shim.gif" height="5" width="1"></div>
'
23
<div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
'
24
</td>
'
25
</tr>
'
26
'
27
<tr height="100%">
'
28
<td height="100%"> </td>
'
29
<td valign="top" width="80%" height="100%">
'
30
'
31
<div class="content">
'
32
<div class="text" style="padding-top: 10px;">
'
33
'
34
<h1>The UNIFICATION TEMPLATES Sub-language</h1>
'
35
'
36
<p>The unification machinery relies on a <em>template
'
37
sub-language</em> to express structural patterns containing
'
38
<em>unification variables</em>. The template sub-language comprises
'
39
several objects organized in a hierarchy that parallels most of the
'
40
standard <strong>CL</strong> type hierarchy.</p>
'
41
'
42
'
43
<h2>Unification Variables</h2>
'
44
'
45
<p><em>Unification variables</em> are symbols with a <code>#\?</code> as the
'
46
first character of the name. This is a rather traditional choice,
'
47
although a different one based on quoted symbols is possible.
'
48
Therefore, the following are examples of variables.
'
49
<pre>
'
50
?A ?s ?qwe ?42z ?a-variable-with-a-very-long-name ?_
'
51
</pre>
'
52
There are two special variables, <code>?_</code> and <code>_</code>,
'
53
which are used as anonymous place holders, they match anything, but
'
54
never appear in a substitution.</p>
'
55
'
56
<h3>Destructuring Template Lambda List</h3>
'
57
'
58
<p><strong>CL</strong> has the concept of <em>destructuring lambda
'
59
list</em> which is used in conjunction with the form
'
60
DSTRUCTURING-BIND, and, to some extent, with LOOP. The unifier
'
61
machinery relies on a related notion dubbed <em>destructuring
'
62
template lambda list</em> for lack of a better name.</p>
'
63
'
64
<p>A <em>destructuring template lambda list</em> (or just
'
65
<em>template lambda list</em>) is just like a regular
'
66
<em>destructuring lambda list</em> (ANSI 3.4.5) with a number of
'
67
restrictions. The full syntax is the following.</p>
'
68
'
69
<p>
'
70
<pre>
'
71
template-lambda-list ::= (<reqvars> <optvars> <restvar> <keyvars>)
'
72
| (<reqvars> <optvars> . <template>)
'
73
'
74
reqvars ::= <template>*
'
75
'
76
optvars ::= [&optional <template>*]
'
77
'
78
restvar ::= [&rest <template>]
'
79
'
80
keyvars ::= [&key {<template> | ({<template> | (<keyword-name> <template>)})}*
'
81
[&allow-other-keys]]
'
82
</pre>
'
83
</p>
'
84
'
85
<p>Where <i><template></i> is either an object with syntax
'
86
defined in the next section or it can be a normal
'
87
<strong>CL</strong> object. The remaining non terminal grammar
'
88
symbols have the usual <strong>CL</strong> interpretation.</p>
'
89
'
90
'
91
'
92
<h2>Unification Templates</h2>
'
93
'
94
<p>The <em>unification templates</em> are organized in an object
'
95
hierachy. There is a standard <strong>CLOS</strong> class for each
'
96
template kind. The hierarchy is shown below.</p>
'
97
'
98
<p>
'
99
<img src="images/unif-templ-hier.gif"></p>
'
100
'
101
<p>The template hierarchy is rooted at the TEMPLATE class. There are
'
102
two <em>kinds</em> of templates: <em>type</em> templates, and
'
103
<em>expression</em> templates. Type templates are used as patterns
'
104
of regular objects. Expression templates are used to unify against
'
105
a specific sub-structure of a given object.</p>
'
106
'
107
<p>The predefined templates are:
'
108
<ul>
'
109
<li><a href="template-class.html">TEMPLATE</a></li>
'
110
<li><a href="expression-template-class.html">EXPRESSION-TEMPLATE</a></li>
'
111
<li><a href="element-template-class.html">ELEMENT-TEMPLATE</a></li>
'
112
<li><a href="aref-template-class.html">AREF-TEMPLATE</a></li>
'
113
<li><a href="elt-template-class.html">ELT-TEMPLATE</a></li>
'
114
<li><a href="nth-template-class.html">NTH-TEMPLATE</a></li>
'
115
'
116
<li><a href="subseq-template-class.html">SUBSEQ-TEMPLATE</a></li>
'
117
'
118
<li><a href="type-template-class.html">TYPE-TEMPLATE</a></li>
'
119
<li><a href="array-template-class.html">ARRAY-TEMPLATE</a></li>
'
120
'
121
<li><a href="sequence-template-class.html">SEQUENCE-TEMPLATE</a></li>
'
122
'
123
<li><a href="list-template-class.html">LIST-TEMPLATE</a></li>
'
124
'
125
<li><a href="vector-template-class.html">VECTOR-TEMPLATE</a></li>
'
126
'
127
<li><a href="string-template-class.html">STRING-TEMPLATE</a></li>
'
128
'
129
<li><a href="nil-template-class.html">NIL-TEMPLATE</a></li>
'
130
'
131
<li><a href="number-template-class.html">NUMBER-TEMPLATE</a></li>
'
132
'
133
<li><a href="standard-object-template-class.html">STANDARD-OBJECT-TEMPLATE</a></li>
'
134
<li><a href="structure-object-template-class.html">STRUCTURE-OBJECT-TEMPLATE</a></li>
'
135
'
136
<li><a href="symbol-template-class.html">SYMBOL-TEMPLATE</a></li>
'
137
</ul>
'
138
'
139
'
140
<!--
'
141
;;; Copyright (c) 2004 Marco Antoniotti, All rigths reserved.
'
142
;;;
'
143
;;; Permission to use, modify, and redistribute this code is hereby
'
144
;;; granted.
'
145
;;; The code is provided AS IS with NO warranty whatsoever. The author
'
146
;;; will not be held liable etc etc etc etc etc.
'
147
-->
'
148
'
149
<h2>Site Map</h2>
'
150
'
151
'
152
<p>Enjoy!</p>
'
153
'
154
'
155
'
156
<hr>
'
157
<p>Questions? Queries? Suggestions? Comments? Please direct them
'
158
at <a href="mailto:marcoxa_PROVA_A_SPAMMARME@alu.org">me</a>.
'
159
</p>
'
160
'
161
</div>
'
162
</div>
'
163
'
164
</td>
'
165
'
166
<!-- <td height="100%"> </td> -->
'
167
</tr>
'
168
'
169
<tr height="100%">
'
170
<td height="100%"> </td>
'
171
<td valign="top" width="80%" height="100%">
'
172
'
173
<div class="content">
'
174
<div class="text" style="padding-top: 10px;">
'
175
2011-04-02 mantoniotti
176
<!-- <h1>News</h1>
2004-11-17 mantoniotti
177
22:19:54 '
178
<p>News in chronological order, most recent on top.
'
179
</p>
'
180
'
181
<ul>
'
182
<li><strong>2004-10-09</strong><br>
'
183
Document created
'
184
</li>
'
185
</ul>
2011-04-02 mantoniotti
186
-->
2004-11-17 mantoniotti
187
</div>
22:19:54 '
188
</div>
'
189
'
190
</td>
'
191
'
192
<td height="100%"> </td>
'
193
</tr>
'
194
'
195
'
196
'
197
'
198
<tr>
'
199
<td colspan="3" valign="bottom" align="right">
'
200
<div class="copyright">
2011-04-02 mantoniotti
201
© 2003-2011, Marco Antoniotti, all rights reserved.
2004-11-17 mantoniotti
202
</div>
22:19:54 '
203
</td>
'
204
</tr>
'
205
'
206
</table>
'
207
</body>
'
208
</html>