Skip to content

Instantly share code, notes, and snippets.

@nulldatamap
Created February 11, 2019 11:16
Show Gist options
  • Save nulldatamap/ec79c91954c40756d0416dd8d282f6b6 to your computer and use it in GitHub Desktop.
Save nulldatamap/ec79c91954c40756d0416dd8d282f6b6 to your computer and use it in GitHub Desktop.
\usepackage{tikz}
\usetikzlibrary{calc}
% ...
\newcommand{\Compiler}[4]{
\draw (#1) -- ++(3, 0) -- ++(0, -1) -- ++(-1, 0)
-- ++(0, -1) -- ++(-1, 0) -- ++(0, 1)
-- ++(-1, 0) -- ++(0, 1);
\node at ($(#1)+(0.5, -0.5)$) {\Large #2};
\node at ($(#1)+(2.5, -0.5)$) {\Large #4};
\node at ($(#1)+(1.5, -1.5)$) {\Large #3};
}
\newcommand{\Machine}[2]{
\draw (#1) -- ++(1, 0) -- ++(-0.5, -1) -- ++(-0.5, 1);
\node at ($(#1)+(0.5, -0.3)$) {#2};
}
\newcommand{\Program}[2]{
\draw (#1) -- ++(0, -1) -- ++(1, 0) -- ++(0, 1);
\draw (#1) [out=150,in=180] to ($(#1)+(0.5,1)$)x
[in=25, out=0] to ($(#1)+(1,0)$);
\node at ($(#1)+(0.5,-0.5)$) {\Large #2};
}
% ...
\begin{tikzpicture}
\Compiler{1,1}{C}{C}{C}
\Compiler{4,0}{C}{x86}{x86}
\Machine{4,1}{x86}
\Program{5,5}{C}
\end{tikzpicture}
@0undefined
Copy link

Syntax error at the end of line #22: x should be ; instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment