summaryrefslogtreecommitdiff
path: root/chapter18/docs/inline-before.svg
blob: 8e15f6eae0c7f09c873c3792684d9ae0067c13cf (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
<svg aria-label="Compiler graph" width="543" height="772" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 543 772" style="font-family: sans-serif;"><style>
    html, body { height:100%; margin:0; font-family:sans-serif; }
    .viewer { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
    .source { padding:8px; border-bottom:1px solid #ccc; }
    #program { width:min(600px,80vw); vertical-align:middle; }
    #status { margin-top:4px; }
    #graph { min-height:0; overflow:hidden; position:relative; background:#fafbfc; }
    #elk { width:100%; height:100%; }
    #graph svg { display:block; }
    .tools { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-top:8px; font-size:12px; }
    .hint { color:#616c78; }
    .ctrl { color:#b63838; } .mem { color:#2867b2; } .data { color:#536477; }
    .edge { fill:none; stroke-width:1.5; }
    .edge.CTRL { stroke-width:2; }
    .edge.ASSOC { stroke-dasharray:4 4; }
    .edge.PARSER { stroke-dasharray:5 4; }
    .parser rect { fill:#f6f0ff; stroke:#7956a5; stroke-width:1.5; stroke-dasharray:5 4; }
    .edge.selected { stroke-width:3.5; }
    .edge.bundle { stroke-width:4; }
    .edge.bundle.selected { stroke-width:6; }
    .edge-hit { fill:none; stroke:transparent; stroke-width:12; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
    .edge-jump { fill:transparent; pointer-events:all; cursor:pointer; }
    .node { cursor:pointer; }
    .box { stroke:#758191; stroke-width:1; }
    .node.held .box { stroke-dasharray:5 3; }
    .node.near .box { stroke:#c18221; stroke-width:2; }
    .node.focus .box { stroke:#9c4900; stroke-width:3; }
    .node.selected .box { stroke:#1569b9; stroke-width:3; }
    .node.folded .box { stroke-width:4; }
    .node.folding .box { fill:#f4ccd7; }
    .fold-tag { font-size:9px; font-weight:700; fill:#963751; }
    .peep-area { fill:#fff3d9; fill-opacity:.8; stroke:#c18221; stroke-width:2; pointer-events:none; }
    .node.peep-edit .box { stroke:#9c4900; stroke-width:3; }
    .node.error .box { stroke:#b42318; stroke-width:4; }
    #event.error { color:#b42318; font-weight:600; white-space:pre-wrap; overflow-wrap:anywhere; }
    .peep-ghosts { pointer-events:none; }
    .region-box { stroke:#9da9b8; stroke-width:1.5; }
    .fold-btn { cursor:pointer; }
    .fold-btn rect { fill:white; stroke:#596674; }
    .fold-btn text { font-size:14px; fill:#152330; }
    .fold-btn:focus rect { stroke:#1569b9; stroke-width:2; }
    .shortcut { cursor:pointer; }
    .shortcut path { fill:none; stroke-width:1.5; }
    .shortcut rect { fill:#fff8ec; stroke:#b63838; stroke-dasharray:3 2; }
    .shortcut text { font-size:11px; fill:#783030; }
    .shortcut.selected rect, .shortcut:focus rect { stroke-width:2.5; }
    .label { font-size:12px; fill:#152330; font-weight:600; }
    .node-id { font-size:10px; fill:#596674; font-weight:400; }
    .type { font-size:11px; fill:#455768; }
    .port { stroke:#536477; stroke-width:1; }
    .row { stroke:#b6afcf; stroke-width:1; }
    .bind { font-size:12px; fill:#152330; }
    .slot { font-size:10px; fill:#364352; paint-order:stroke; stroke:#fafbfc; stroke-width:3; }
    #detail { position:absolute; top:8px; right:8px; margin:0; padding:12px; max-width:320px;
      max-height:45%; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere;
      background:#fffffff2; border:1px solid #bac5d0; border-radius:4px; font-size:12px; }
    .controls { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; padding:6px; }
    .button { color:white; background:black; font-size:20px; min-width:30px; }
    .button:disabled { background:grey; }
    .count { font-size:20px; min-width:35px; text-align:center; }
    #N { width:6ch; }
    #scrub { width:clamp(120px,35vw,600px); }
  </style><defs><marker id="arrow-CTRL" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#b63838"/></marker><marker id="arrow-DATA" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#536477"/></marker><marker id="arrow-MEM" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#2867b2"/></marker><marker id="arrow-ASSOC" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#9396a3"/></marker><marker id="arrow-PARSER" viewBox="0 -4 8 8" refX="8" refY="0" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,-4L8,0L0,4Z" fill="#7956a5"/></marker></defs><rect width="100%" height="100%" fill="rgb(250, 251, 252)"/><g><g class="regions" style="opacity: 1;"/><rect class="peep-area" rx="36" style="opacity: 0;"/><g class="edges"><path class="edge DATA" id="e4i2" d="M96,80 L96,128" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#4[2] → #1 · DATA</title></path><path class="edge DATA" id="e4i3" d="M248,80 L248,85 Q248,90 243,90 L128,90 Q120,90 120,98 L120,128" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#4[3] → #3 · DATA</title></path><path class="edge CTRL" id="e5i2" d="M84,184 L84,189 Q84,194 89,194 L177,194 Q185,194 185,202 L185,232" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#5[2] → #4 · CTRL</title></path><path class="edge DATA" id="e7i1" d="M257,184 L257,189 Q257,194 262,194 L279,194 Q287,194 287,202 L287,232" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[1] → #6 · DATA</title></path><path class="edge DATA" id="e7i2" d="M96,80 L96,92 Q96,100 104,100 L319,100 Q327,100 327,108 L327,232" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#7[2] → #1 · DATA</title></path><path class="edge DATA" id="e8i1" d="M307,288 L307,336" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[1] → #7 · DATA</title></path><path class="edge DATA" id="e8i2" d="M459,288 L459,293 Q459,298 454,298 L345,298 Q337,298 337,306 L337,336" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#8[2] → #2 · DATA</title></path><path class="edge DATA" id="e9i2" d="M307,392 L307,440" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#9[2] → #8 · DATA</title></path><path class="edge CTRL" id="e10i0" d="M84,184 L84,544" stroke="#b63838" marker-start="url(#arrow-CTRL)" style="opacity: 1;"><title>#10[0] → #4 · CTRL</title></path><path class="edge DATA" id="e10i1" d="M295,496 L295,501 Q295,506 290,506 L132,506 Q124,506 124,514 L124,544" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#10[1] → #9 · DATA</title></path><path class="edge DATA" id="e12i2" d="M104,644 L104,692" stroke="#536477" marker-start="url(#arrow-DATA)" style="opacity: 1;"><title>#12[2] → #11 · DATA</title></path></g><g class="edge-hits"/><g class="parser" style="opacity: 1;"/><g class="nodes"><g class="node" id="n1" data-id="1" transform="translate(36,30)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Parm_arg</tspan><tspan class="node-id">  #1</tspan></text><text class="type" text-anchor="middle" y="35" x="60">int</text><title>#1 Parm_arg
int

[0] → —  ASSOC
[1] → —  DATA</title><circle class="port" cx="0" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="white"/><text class="slot" x="0" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text></g><g class="node" id="n2" data-id="2" transform="translate(399,238)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Con</tspan><tspan class="node-id">  #2</tspan></text><text class="type" text-anchor="middle" y="35" x="60">1</text><title>#2 Con
1

</title></g><g class="node" id="n3" data-id="3" transform="translate(188,30)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Con inc</tspan><tspan class="node-id">  #3</tspan></text><text class="type" text-anchor="middle" y="35" x="60">{int -&gt; int}</text><title>#3 Con inc
{int -&gt; int}

</title></g><g class="node" id="n4" data-id="4" transform="translate(24,134)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Call</tspan><tspan class="node-id">  #4</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#4 Call
Type not computed

[0] → —  CTRL
[1] → —  MEM
[2] → #1  DATA
[3] → #3  DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="white"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="#536477"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n5" data-id="5" transform="translate(95,238)" style="opacity: 1;"><path class="box" d="M10,0H110L120,10V34L110,44H10L0,34V10Z" fill="#ffe0ab"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>inc</tspan><tspan class="node-id">  #5</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#5 inc
Type not computed

[0] → —  ASSOC
[1] → —  CTRL
[2] → #4  CTRL</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="white"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n6" data-id="6" transform="translate(197,134)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Con</tspan><tspan class="node-id">  #6</tspan></text><text class="type" text-anchor="middle" y="35" x="60">int</text><title>#6 Con
int

</title></g><g class="node" id="n7" data-id="7" transform="translate(247,238)" style="opacity: 1;"><path class="box" d="M12,0H108L120,22L108,44H12L0,22Z" fill="#f5e4fa"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Parm_x</tspan><tspan class="node-id">  #7</tspan></text><text class="type" text-anchor="middle" y="35" x="60">int</text><title>#7 Parm_x
int

[0] → #5  ASSOC
[1] → #6  DATA
[2] → #1  DATA</title><circle class="port" cx="-3" cy="22" r="3" fill="#536477"/><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><path class="reg" fill="none" stroke="#b63838" d="M-3,22H-18m4,-3l-4,3l4,3"><title>[0] → #5</title></path><text class="slot" x="-10" y="15" text-anchor="middle">0</text><text class="slot" x="40" y="-10" text-anchor="middle">1</text><text class="slot" x="80" y="-10" text-anchor="middle">2</text></g><g class="node" id="n8" data-id="8" transform="translate(247,342)" style="opacity: 1;"><path class="box" d="M14,0H106Q120,0 120,14V30Q120,44 106,44H14Q0,44 0,30V14Q0,0 14,0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Add</tspan><tspan class="node-id">  #8</tspan></text><text class="type" text-anchor="middle" y="35" x="60">int</text><title>#8 Add
int

[0] → —  CTRL
[1] → #7  DATA
[2] → #2  DATA</title><circle class="port" cx="30" cy="-3" r="3" fill="white"/><circle class="port" cx="60" cy="-3" r="3" fill="#536477"/><circle class="port" cx="90" cy="-3" r="3" fill="#536477"/><text class="slot" x="30" y="-10" text-anchor="middle">0</text><text class="slot" x="60" y="-10" text-anchor="middle">1</text><text class="slot" x="90" y="-10" text-anchor="middle">2</text></g><g class="node" id="n9" data-id="9" transform="translate(235,446)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return inc</tspan><tspan class="node-id">  #9</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#9 Return inc
Type not computed

[0] → —  CTRL
[1] → —  MEM
[2] → #8  DATA
[3] → —  DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="white"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g><g class="node" id="n10" data-id="10" transform="translate(44,550)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>CallEnd</tspan><tspan class="node-id">  #10</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#10 CallEnd
Type not computed

[0] → #4  CTRL
[1] → #9  DATA</title><circle class="port" cx="40" cy="-3" r="3" fill="#536477"/><circle class="port" cx="80" cy="-3" r="3" fill="#536477"/><text class="slot" x="40" y="-10" text-anchor="middle">0</text><text class="slot" x="80" y="-10" text-anchor="middle">1</text></g><g class="node" id="n11" data-id="11" transform="translate(44,594)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#edf3f7"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>result</tspan><tspan class="node-id">  #11/2</tspan></text><text class="type" text-anchor="middle" y="35" x="60">int</text><title>#11 result
Projection 2 of #10
int

[0] → #10  DATA</title></g><g class="node" id="n12" data-id="12" transform="translate(32,698)" style="opacity: 1;"><path class="box" d="M0,0H120V44H0Z" fill="#fff1c4"/><text class="label" text-anchor="middle" x="60" y="18"><tspan>Return main</tspan><tspan class="node-id">  #12</tspan></text><text class="type" text-anchor="middle" y="35" x="60"/><title>#12 Return main
Type not computed

[0] → —  CTRL
[1] → —  MEM
[2] → #11  DATA
[3] → —  DATA</title><circle class="port" cx="24" cy="-3" r="3" fill="white"/><circle class="port" cx="48" cy="-3" r="3" fill="white"/><circle class="port" cx="72" cy="-3" r="3" fill="#536477"/><circle class="port" cx="96" cy="-3" r="3" fill="white"/><text class="slot" x="24" y="-10" text-anchor="middle">0</text><text class="slot" x="48" y="-10" text-anchor="middle">1</text><text class="slot" x="72" y="-10" text-anchor="middle">2</text><text class="slot" x="96" y="-10" text-anchor="middle">3</text></g></g><g class="region-heads" style="opacity: 1;"/><g class="shortcuts" style="opacity: 1;"/><g class="peep-ghosts" pointer-events="none"/></g></svg>