tomArchi.tex 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. %\begin{figure}[H]%[h!]
  2. % Define the layers to draw the diagram
  3. \pgfdeclarelayer{background}
  4. \pgfsetlayers{background,main}
  5. % Define a new shape: page with a folded corner
  6. \makeatletter
  7. \pgfdeclareshape{flippedpage}{
  8. \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
  9. \inheritanchorborder[from=rectangle]
  10. \inheritanchor[from=rectangle]{center}
  11. \inheritanchor[from=rectangle]{north}
  12. \inheritanchor[from=rectangle]{south}
  13. \inheritanchor[from=rectangle]{west}
  14. \inheritanchor[from=rectangle]{east}
  15. % ... and possibly more
  16. \backgroundpath{% this is new
  17. % store lower left in xa/ya and upper right in xb/yb
  18. \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
  19. \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
  20. % compute corner of ``flipped page''
  21. \pgf@xc=\pgf@xb \advance\pgf@xc by-5pt % this should be a parameter
  22. \pgf@yc=\pgf@yb \advance\pgf@yc by-5pt
  23. % diagonal path of the corner
  24. \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
  25. \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
  26. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  27. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  28. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
  29. \pgfpathclose
  30. % add little corner
  31. \pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
  32. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  33. \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}}
  34. \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
  35. }
  36. }
  37. % Define block styles
  38. \tikzstyle{plugin}=[draw, fill=white, text width=0.8cm, text centered,
  39. minimum height=0.8cm, rounded corners=1]
  40. %\tikzstyle{specialplugin}=[draw, fill=blue!20, text width=0.8cm, text centered,
  41. %minimum height=0.8cm, rounded corners=1]
  42. \tikzstyle{specialplugin}=[draw, fill=blue!20, text width=0.8cm, text centered,
  43. minimum height=0.8cm, rounded corners=1, dashed]
  44. \tikzstyle{code}=[draw,shape=flippedpage,text width=0.5cm, text centered,
  45. minimum height=2.5em,fill=white]
  46. \tikzstyle{texttitle}=[fill=white, rounded corners=1, draw=black!50]%, dashed]
  47. \tikzstyle{background}=[rounded corners=1, draw=black!50]%, dashed]
  48. % \begin{center}
  49. \begin{tikzpicture}[scale=0.93]
  50. % Draw diagram elements
  51. \node (transformer) [specialplugin] {\minicode{transformer}};
  52. \path (transformer)+(-1.5,1.9) node (tomfile) [code]
  53. {\minicode{Code {\tom}}};
  54. \path (transformer)+(-1.5,0.0) node (parser) [plugin, dashed]
  55. {\minicode{parser}};
  56. \path (transformer)+(1.5,0.0) node (syntaxchecker) [plugin]
  57. {\minicode{syntax checker}};
  58. \path (transformer)+(3.0,0.0) node (desugarer) [plugin]
  59. {\minicode{desugarer}};
  60. \path (transformer)+(4.5,0.0) node (typer) [plugin]
  61. {\minicode{typer}};
  62. \path (transformer)+(6,0.0) node (typechecker) [plugin]
  63. {\minicode{type checker}};
  64. \path (transformer)+(7.5,0.0) node (expander) [plugin]
  65. {\minicode{expander}};
  66. \path (transformer)+(9.0,0.0) node (compiler) [plugin]
  67. {\minicode{compiler}};
  68. \path (transformer)+(10.5,0.0) node (optimizer) [plugin]
  69. {\minicode{optimizer}};
  70. \path (transformer)+(12.0,0.0) node (backend) [plugin, dashed]
  71. {\minicode{backend}};
  72. \path (transformer)+(12,-1.9) node (javafile) [code]
  73. {\minicode{Code hôte}};
  74. % Draw arrows between elements
  75. \path [draw, ->] (tomfile.south) -- node [left] {} (parser);
  76. \path [draw, ->] (parser.east) -- node [left] {} (transformer);
  77. \path [draw, ->] (transformer.east) -- node [above] {} (syntaxchecker);
  78. %\path [draw, ->] (parser.east) -- node [above] {} (syntaxchecker);
  79. \path [draw, ->] (syntaxchecker.east) -- node [above] {} (desugarer);
  80. \path [draw, ->] (desugarer.east) -- node [above] {} (typer);
  81. \path [draw, ->] (typer.east) -- node [above] {} (typechecker);
  82. \path [draw, ->] (typechecker.east) -- node [above] {} (expander);
  83. \path [draw, ->] (expander.east) -- node [above] {} (compiler);
  84. \path [draw, ->] (compiler.east) -- node [above] {} (optimizer);
  85. \path [draw, ->] (optimizer.east) -- node [above] {} (backend);
  86. \path [draw, ->] (backend.south) -- node [above] {} (javafile);
  87. % Draw layer titles
  88. \path (typechecker)+(0.0,1.0) node (tomtitle) [texttitle]
  89. {\figcode{Compilateur {\tom}}};
  90. % Draw background
  91. \begin{pgfonlayer}{background}
  92. % Left-top corner of the background rectangle
  93. \path (parser.west |- parser.north)+(-0.3,0.5) node (a) {};
  94. % Right-bottom corner of the background rectangle
  95. \path (backend.east|- backend.south)+(0.3,-0.5) node (b) {};
  96. % Draw the background
  97. \path[background]
  98. (a) rectangle (b);
  99. \end{pgfonlayer}
  100. \end{tikzpicture}
  101. % \end{center}
  102. % \caption{Phases du compilateur {\tom}}
  103. %\label{fig:tomArchi}
  104. %\end{figure}