|
| 1 | +\tikzset{ |
| 2 | + start fun/.style={ |
| 3 | + fun=\texttt{start\_fun}, |
| 4 | + function arity=0, |
| 5 | + }, |
| 6 | +} |
| 7 | + |
| 8 | +\begin{scope} |
| 9 | +\def\smalllistitemsize{1.5cm} |
| 10 | +\tikzset{ |
| 11 | + every list/.append style={ |
| 12 | + element size=\smalllistitemsize, |
| 13 | + }, |
| 14 | +} |
| 15 | + |
| 16 | +\matrix[tuple=1, element size=\smalllistitemsize] { |
| 17 | + \node (t11) [placeholder=2]; & \node [separator]; & |
| 18 | + \node (acc1) {$acc_1$}; \\ |
| 19 | +}; |
| 20 | + |
| 21 | +\matrix at (t11) [list=b1, element=a] { |
| 22 | + \node [index=1]; & |
| 23 | + \node [index=2]; \\ |
| 24 | +}; |
| 25 | + |
| 26 | +\matrix[tuple=2, right=of tuple 1, element size=\smalllistitemsize] { |
| 27 | + \node (t21) [placeholder=3]; & \node [separator]; & |
| 28 | + \node (acc2) {$acc_2$}; \\ |
| 29 | +}; |
| 30 | + |
| 31 | +\matrix at (t21) [list=b2, element=a] { |
| 32 | + \node [index=3]; & |
| 33 | + \node [index=4]; & |
| 34 | + \node [index=5]; \\ |
| 35 | +}; |
| 36 | + |
| 37 | +\matrix[tuple=i, right=1 of tuple 2, element size=\smalllistitemsize] { |
| 38 | + \node (ti1) [placeholder=2]; & \node [separator]; & |
| 39 | + \node (acci) {$acc_i$}; \\ |
| 40 | +}; |
| 41 | + |
| 42 | +\matrix at (ti1) [list=bi, element=a] { |
| 43 | + \node [index=n-1]; & |
| 44 | + \node [index=n]; \\ |
| 45 | +}; |
| 46 | + |
| 47 | +\matrix [tuple=i+1, right=of tuple i] { |
| 48 | + \node {\texttt{:halt}}; & \node [separator]; & |
| 49 | + \node (acci+1) {$acc_{i+1}$}; \\ |
| 50 | +}; |
| 51 | +\end{scope} |
| 52 | + |
| 53 | +\foreach \i in {1,2,i,i+1}{ |
| 54 | + \draw [brace] (tuple \i.north west) -- (tuple \i.north east); |
| 55 | + \draw [<-] (last brace) -- +(0, .5) |
| 56 | + node (fun\i) [fun, anchor=out]; |
| 57 | +} |
| 58 | + |
| 59 | +\draw [<-] (fun1.in) -- +(0, .5) |
| 60 | + node (start fun) [start fun, anchor=out]; |
| 61 | + |
| 62 | +\draw [->] (acci+1.south) -- +(0, -.5) |
| 63 | + node (after fun) [fun=\texttt{after\_fun}, anchor=in]; |
| 64 | + |
| 65 | +\draw [->] (after fun.out) -- +(0, -.5) |
| 66 | + node [below] {\_}; |
| 67 | + |
| 68 | +\coordinate (top rule) at (start fun); |
| 69 | +\coordinate (bottom rule) at ($ (acc1.south) + (0, -1) $); |
| 70 | + |
| 71 | +\draw [->] |
| 72 | + (acc1.south) |
| 73 | + -- (\currcoord |- bottom rule) |
| 74 | + -| ($ (tuple 1.east)!.5!(tuple 2.west) $) |
| 75 | + -- (\currcoord |- top rule) |
| 76 | + -| (fun2.in); |
| 77 | + |
| 78 | +\draw [->, dotted] |
| 79 | + (acc2.south) |
| 80 | + -- (\currcoord |- bottom rule) |
| 81 | + -| ($ (tuple 2.east)!.5!(tuple i.west) $) |
| 82 | + -- (\currcoord |- top rule) |
| 83 | + -| (funi.in); |
| 84 | + |
| 85 | +\draw [->] |
| 86 | + (acci.south) |
| 87 | + -- (\currcoord |- bottom rule) |
| 88 | + -| ($ (tuple i.east)!.5!(tuple i+1.west) $) |
| 89 | + -- (\currcoord |- top rule) |
| 90 | + -| (funi+1.in); |
| 91 | + |
| 92 | +\matrix [list=a, below=2 of $ (list b1)!.5!(list bi) $] { |
| 93 | + \node [index=1]; & |
| 94 | + \node [index=2]; & |
| 95 | + \node [index=3]; & |
| 96 | + \node [index=4]; & |
| 97 | + \node [index=5]; & |
| 98 | + \node [elements between]; & |
| 99 | + \node [index=n-1]; & |
| 100 | + \node [index=n]; \\ |
| 101 | +}; |
| 102 | + |
| 103 | +\bracetobrace |
| 104 | + {b12.south east}{b11.south west} |
| 105 | + {a1.north west}{a2.north east} |
| 106 | + |
| 107 | +\bracetobrace |
| 108 | + {b25.south east}{b23.south west} |
| 109 | + {a3.north west}{a5.north east} |
| 110 | + |
| 111 | +\bracetobrace |
| 112 | + {bin.south east}{bin-1.south west} |
| 113 | + {an-1.north west}{an.north east} |
| 114 | + |
0 commit comments