summaryrefslogtreecommitdiff
path: root/web/spiderweb/src/penelope/processed-a.spider
blob: db6529bcbb303450f3d11a7c309c277743705781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# Copyright 1989 by Norman Ramsey, Odyssey Research Associates
# Not to be sold, but may be used freely for any purpose
# For more information, see file COPYRIGHT in the parent directory
language Ada extension ada

at_sign @

module definition stmt use math

comment begin <dash-dash-space> end newline
macros begin
\def\commentbegin{{\tt -- }}
macros end

line begin <dash-dash-"line"> end <"">

default translation <*> mathness yes

token identifier category math mathness maybe
token number category math mathness yes
token newline category nl translation <> mathness maybe 
# newline mathness must be no to work with busted_comment
token pseudo_semi translation <> category semi mathness maybe

macros begin
\let\R\relax
macros end

# Delimiters
token & category binop translation <"\\amp">
token ( category open 
token ) category close 
token * category binop
token + category unorbinop
token , category binop translation <",\\,"-opt-3>
token - category unorbinop
token . category binop
token / category binop
token : category binop 
token ; category semi translation <";"-space-opt-2> 
token < category binop
token = category binop
token > category binop
token | category binop translation <"\\mid"> 

# Compound delimiters

token => category arrow translation <"\\AR">
token .. category binop translation <"\\.{..}">
token ** category binop 
token := category binop translation <"\\mathbin{:=}">
token /= translation <"\\I"> category binop 
token >= translation <"\\G"> category binop 
token <= translation <"\\L"> category binop 
token << translation <"\\LL"> category openlabel 
token >> translation <"\\GG"> category closelabel 
token <> translation <"\\LG"> category math

# Hacks no ', and this becomes a binary op
token ' category binop mathness no 

token # category math translation <"\\#"> 
token -- category busted_comment mathness no translation <"\\C{">




default mathness maybe translation <*>

reserved abort ilk math_like
reserved abs ilk unop_like
reserved accept ilk proc_like
reserved access ilk math_like
reserved all ilk math_like
reserved and ilk and_like
reserved array ilk math_like
reserved at ilk at_like
reserved begin ilk begin_like
reserved body ilk math_like
reserved case ilk case_like
reserved constant ilk math_like
reserved declare ilk decl_like
reserved delay ilk math_like
reserved delta ilk math_like
reserved digits ilk math_like
reserved do ilk is_like
reserved else ilk else_like
reserved elsif ilk elsif_like
reserved end ilk end_like
reserved entry ilk proc_like
reserved exception ilk ex_like
reserved exit ilk math_like
reserved for ilk math_like
reserved function ilk proc_like
reserved generic ilk gen_like
reserved goto ilk math_like
reserved if ilk if_like
reserved in ilk unorbinop_like
reserved is ilk is_like 
reserved limited ilk math_like
reserved loop ilk loop_like
reserved mod ilk binop_like
reserved new ilk separate_like
reserved not ilk unop_like
reserved null ilk math_like
reserved of ilk math_like
reserved or ilk or_like
reserved others ilk math_like
reserved out ilk math_like
reserved package ilk proc_like
reserved pragma ilk math_like
reserved private ilk private_like
reserved procedure ilk proc_like
reserved raise ilk math_like
reserved range ilk math_like
reserved record ilk record_like
reserved rem ilk binop_like
reserved renames ilk math_like
reserved return ilk math_like
reserved reverse ilk math_like
reserved select ilk begin_like
reserved separate ilk separate_like
reserved subtype ilk math_like
reserved task ilk proc_like
reserved terminate ilk math_like
reserved then ilk then_like
reserved type ilk math_like
reserved use ilk math_like
reserved when ilk when_like
reserved while ilk math_like
reserved with ilk with_like
reserved xor ilk binop_like

ilk and_like translation <*> category and
ilk at_like translation <*> category at
ilk begin_like translation <*-indent> category beginning
ilk binop_like translation <"\\"-space-*-"\\"-space> category binop
ilk case_like translation <*> category case
ilk decl_like translation <*-indent> category declaration
ilk else_like translation <*> category else
ilk elsif_like translation <*> category elsif
ilk end_like translation <*> category close
ilk ex_like translation <*> category exception
ilk gen_like translation <*-indent> category generic
ilk if_like translation <*> category if
ilk is_like translation <*> category is mathness no
ilk loop_like translation <*> category loop
ilk math_like translation <*> category math
ilk or_like translation <*> category or
ilk private_like translation <*> category private
ilk proc_like translation <*> category proc
ilk record_like translation <*> category record
ilk separate_like translation <*> category separate
ilk then_like translation <*> category then
ilk unop_like translation <*-"\\"-space> category unop
ilk unorbinop_like translation <"\\"-space-*-"\\"-space> category resunorbinop
ilk when_like translation <*> category when
ilk where_like category where
ilk with_like translation <*> category with


# \MC means ``math close'' and sets \MS to ``math set''
macros begin
\def\MC{\ifmmode\global\let\MS$\else\global\let\MS\relax\fi\relax\MS}
\def\LG{\mathord{<}\mathord{>}}
\let\IG=\ignorespaces
macros end



busted_comment <"\\MC}\\MS\\R"-force> nl --> ignore_scrap
busted_comment ? --> busted_comment

beginning <outdent-force> continuation <outdent-force> ending --> stmt
beginning <outdent-force> ending --> stmt
beginning <force> (stmt|ignore_scrap) --> beginning

case <"\\"-space> math <"\\"-space> is <indent-force> --> beginning

close semi --> ending
close <"\\"-space> ? semi --> ending
close <"\\"-space> ? <"\\"-space> ? semi --> ending

continuation <force> (stmt|ignore_scrap) --> continuation
continuation <outdent-force> continuation --> continuation


declaration <outdent-force> beginning <outdent-force> continuation <outdent-force> ending --> stmt
declaration <outdent-force> beginning <outdent-force> ending --> stmt
declaration <outdent-force> ending --> stmt
declaration <force> (stmt|ignore_scrap) --> declaration

else <indent-force> --> continuation
elsif <"\\"-space> math <"\\"-space> then <indent-force> --> continuation

exception <indent-force> --> continuation

generic <outdent-force> declaration --> declaration
generic <force> (stmt|ignore_scrap) --> generic

if <"\\"-space> math <"\\"-space> then --> ifthen
ifthen <indent-force> stmt --> beginning
ifthen <indent-force> <"\\"-space> math <"\\"-space> <outdent-force> else --> ifthen
ifthen <indent-force> <"\\"-space> math <"\\"-space> <outdent-force> close <"\\"-space> if --> math
ifthen <indent-force> <"\\"-space> math <"\\"-space> <outdent-force> elsif --> if


is --> math

loop <indent-force> --> beginning

math [ <"\\"-space> and <"\\"-space> then <"\\"-space> ] --> math binop
math [ <"\\"-space> and <"\\"-space> ] --> math binop

math (binop|unorbinop) math --> math
math <"\\"-space> resunorbinop <"\\"-space>  math --> math
(unorbinop|unop) math --> math
resunorbinop <"\\"-space>  math --> math
# This doesn't apply in Ada:  math unop --> math

math arrow --> math
math binop <"\\"-space> exception --> math
math <space> is --> math
math <"\\"-space> loop --> loop
math <"\\"-space> math --> math
math [ <"\\"-space> or <"\\"-space> else <"\\"-space> ] --> math binop
math [ <"\\"-space> or <"\\"-space> ] --> math binop
math <"\\"-space> private --> math
math <"\\"-space> separate --> math
math <indent-force> stmt <outdent-force> --> stmt
math terminator --> stmt

open close --> math
open math close --> math
open [ math semi ] --> open math

<force-backup> openlabel math closelabel <force> --> math

or <indent-force> --> continuation

private <indent-force> --> beginning

proc <"\\"-space> math <space> is <"\\"-space> separate --> math
proc <"\\"-space> math <space> is <indent-force> --> declaration
proc <"\\"-space> math terminator --> stmt

record <"\\"-space> at <"\\"-space> math terminator <indent-force> --> beginning
record <indent-force> --> beginning

semi --> terminator

stmt <force> stmt --> stmt

when <"\\"-space> math arrow <indent-force> --> whengroup
[ when <"\\"-space> math ] terminator --> math terminator
whengroup stmt <outdent-force> ending --> ending
whengroup stmt <outdent-force> whengroup --> whengroup

where <indent> --> beginning

with <"\\"-space> math --> math
with <"\\"-space> proc <"\\"-space> math --> math

? ignore_scrap --> #1


########################### Additional stuff for PolyAnna ##################

# PolyAnna delimiters

default mathness yes

token --: category virtual translation <"\\R\\IG"> mathness no
token --| category annotation translation <"\\R\\IG"> mathness no
token <=> category arrow translation <"\\DA">
token -> category binop translation <"\\RA">

# We might use these guys for PolyAnna

# token [ category open 
# token ] category close 
# token { translation <"\\{"> category open 
# token } translation <"\\}"> category close 



# Polyanna reserved words

default mathness maybe translation <*>

reserved based ilk math_like
reserved bound ilk math_like
reserved exists ilk math_like
reserved forall ilk math_like
reserved global ilk math_like
reserved mathforall ilk forall_like
reserved on ilk math_like
reserved such ilk math_like
reserved that ilk math_like
reserved trait ilk math_like
reserved virtual ilk separate_like
reserved where ilk where_like

ilk forall_like translation <"\\forall"> category math mathness yes



# The line below will cause scan_annotations.awk to generate code for
# scanning annotations and virtual text. The integer is the depth of nesting.
# (sp is short for "suspend parse", and is created when annotations are
# encountered in the midst of virtual text.
#scan_annotations 10

# automatically generating productions...


# "annotation" expansion sequence

annotation [ !(nl|sp) nl annotation ] --> annotation #2
annotation !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) #3
annotation !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) #4
annotation !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) #5
annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #6
annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #7
annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #8
annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #9
annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl annotation ] --> annotation !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #10

# "virtual" expansion sequence

virtual [ !(nl|sp) nl virtual ] --> virtual #2
virtual !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) #3
virtual !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) #4
virtual !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) #5
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #6
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #7
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #8
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #9
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ !(nl|sp) nl virtual ] --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) #10

# "virtual" -- "annotation" expansion sequence

virtual !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation
virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) [ nl ] annotation --> virtual !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) !(nl|sp) sp annotation


# end of automatically generated productions


# recognize the end of a group of annotations
[ <"\\AN{"> annotation !(nl|sp) nl <"\\MC}\\MS\\R"> ] !annotation --> annotation_group !annotation

# recognize the end of some lines of virtual text
[ <"\\VI{"> virtual !(nl|sp) nl <"\\MC}\\MS\\R"> ] !(virtual|annotation) --> virtual_group !(virtual|annotation)

# ignore a group of annotations in the midst of virtual text
<"\\MC}\\MS\\R"> sp <force> annotation_group <force-"\\VI{"> virtual --> ignore_scrap
# if a virtual text terminates with a group of annotations, just turn the
# suspended parse into a newline---this terminates the virtual text.
[ sp ] annotation_group !virtual --> nl annotation_group !virtual


# put annotations or virtual text in a block by itself, and ignore it
# in other parsing.
<force> (annotation_group|virtual_group) <force> --> ignore_scrap

# ignore newlines except in the special situations listed above
!(annotation|virtual|sp|busted_comment) nl --> #1







macros begin
\def\AN{\markpar{--|}}
\def\VI{\markpar{\frenchspacing--:}}
\let\AR=\Longrightarrow
\let\RA=\rightarrow
\let\DA=\Longleftrightarrow
\let\AS\K
\def\MG{\mathrel{\to}}

\newbox\window
\newbox\icon
\newif\ifmarkdo
\newdimen\markh\markh=.83333333\baselineskip
\newdimen\saveindent
\newcount\saveind

\def\markpar#1#2{\setbox\icon=\hbox{\.{#1 }}%
\saveindent=\hangindent
\saveind=\ind
\setbox\window=\vbox{\advance\hsize by -\wd\icon
\advance\hsize by -\saveindent
\global\ind=2\hangindent=\ind em
\hbox{This line will get peeled}
\noindent\kern\ind em\copy\bakk\ignorespaces#2}%
\hangindent=\saveindent
\global\ind=\saveind
\vbox{
\splittopskip=\markh\vbadness=10000\setbox0=\vsplit\window to\markh
\loop \ifvoid\window\markdofalse\else\markdotrue\fi
\ifmarkdo
\hbox{\unhcopy\icon\vsplit\window to\markh}
\repeat
}}

\input frames
macros end