blob: 1cba6f6435373092c845765c10457314a9b7e25f (
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
|
% file: o2_Toverview.mp
% enumeration and the 4 T classes
input boxes
u:=1cc;
pair sep,fldsep;
sep := (0,3u);
fldsep := (2u,0);
beginfig(1);
boxit.tclass(btex Terminal vocabulary etex); % enumeration
boxit.enum(btex enumeration etex); % enumeration
boxit.lr(btex lrk meta-terminal constants etex); % lrk
boxit.rc(btex raw characters etex); % raw characters
boxit.err(btex errors etex); % error tokens
boxit.t(btex terminals etex); % basic terminal tokens
% place the boxes
enum.e + fldsep = lr.w;
lr.e + fldsep = rc.w;
rc.e + fldsep = t.w;
t.e + fldsep = err.w;
ypart enum.n = ypart lr.n = ypart rc.n = ypart t.n = ypart err.n;
drawboxed(enum);
drawboxed(lr);
drawboxed(rc);
drawboxed(t);
drawboxed(err);
.5[tclass.e,tclass.w] - sep = .5[enum.e,err.w];
drawboxed(tclass);
numeric a;
a := ypart tclass.c - ypart .5sep;
draw tclass.s -- (xpart tclass.s, a);
draw (xpart enum.n,a) -- (xpart err.n,a); % horozontal line
drawarrow (xpart enum.n,a) -- enum.n;
drawarrow (xpart lr.n,a) -- lr.n;
drawarrow (xpart rc.n,a) -- rc.n;
drawarrow (xpart t.n,a) -- t.n;
drawarrow (xpart err.n,a) -- err.n;
endfig;
end;
|