input boxes;
verbatimtex
%&latex
\documentclass{article}
\include{macros}
\begin{document}
etex

beginfig(1);
numeric hsep,vsep;
hsep=3.5cm;
vsep=1.5cm;

color mygrey;
mygrey=(0.8,0.8,0.8);

boxit.datatype(btex ADT etex);
boxit.javatom(btex {\tom}+{\java} etex);
boxit.tommapping(btex mapping.tom etex);
boxit.generatedjava(btex {\java} etex);
boxit.generatedjavauser(btex {\java} etex);
boxit.gomgeneratedjava(btex {\java}+{\tom} etex);
boxit.bytecode(btex bytecode etex);
boxit.union(btex $\cup$ etex);

circleit.gom(btex {\gom} etex);
circleit.tom(btex {\tom} compiler etex);
circleit.tomuser(btex {\tom} compiler etex);
circleit.javac(btex javac etex);

% all boxes have the same height
datatype.dx=datatype.dy=0.3cm;
javatom.dx=javatom.dy=0.3cm;
tommapping.dx=tommapping.dy=0.3cm;
generatedjava.dx=generatedjava.dy=0.3cm;
generatedjavauser.dx=generatedjavauser.dy=0.3cm;
gomgeneratedjava.dx=gomgeneratedjava.dy=0.3cm;
bytecode.dx=bytecode.dy=0.3cm;
gom.dx=gom.dy=0.3cm;
tom.dx=tom.dy=0.3cm;
union.dx=union.dy=0.3cm;
tomuser.dx=tomuser.dy=0.3cm;
javac.dx=javac.dy=0.3cm;

% gom generation
datatype.c-gom.c=
gom.c-gomgeneratedjava.c=
gomgeneratedjava.c-tom.c=
tom.c-generatedjava.c=(0,vsep);



% tom
tommapping.e=union.w;
union.e=javatom.w;

pair join;
union.c-join=
join-tomuser.c=
tomuser.c-generatedjavauser.c=(0,vsep);

%java
javac.c-bytecode.c=(0,vsep);
(xpart javac.c)-(xpart generatedjava.c)=
(xpart generatedjavauser.c)-(xpart javac.c)=hsep;
(ypart generatedjava.c)-(ypart javac.c)=
(ypart generatedjavauser.c)-(ypart javac.c)=vsep;

fill bpath(datatype) withcolor mygrey;
fill bpath(javatom) withcolor mygrey;

drawboxed(datatype,gomgeneratedjava,javatom,tommapping,generatedjava,generatedjavauser,bytecode,gom,tom,tomuser,javac);

drawunboxed(union);

drawarrow datatype.s--gom.n;
drawarrow gom.s--gomgeneratedjava.n;
drawarrow gomgeneratedjava.s--tom.n;
drawarrow tom.s--generatedjava.n;

drawarrow gom.e--tommapping.w;

draw tommapping.s--join;
draw javatom.s--join;
drawarrow join--tomuser.n;
drawarrow tomuser.s--generatedjavauser.n;

drawarrow generatedjava.s..{right}javac.w;
drawarrow generatedjavauser.s..{left}javac.e;
drawarrow javac.s--bytecode.n;

z1=datatype.c+(-1/2*hsep,1/2*vsep);
z2=datatype.c+(1/2*hsep,1/2*vsep);
z3=generatedjava.c+(1/2*hsep,-1/2*vsep);
z4=generatedjava.c+(-1/2*hsep,-1/2*vsep);
draw z1--z2--z3--z4--cycle dashed withdots;

endfig;

end
