daily pastebin goal
51%
SHARE
TWEET

To accompany http://i.imgur.com/T1l6eN4.png?1

a guest May 27th, 2015 286 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. #  I, the copyright holder of this work, hereby release it into the public
  4. #  domain.  This applies worldwide.
  5.  
  6. set -e
  7.  
  8. cat<<EOF > left-recursive-parse-of-a-double-subtraction.mp
  9. prologues:=2;
  10. verbatimtex
  11. \documentclass{article}
  12. \begin{document}
  13. etex
  14. ;
  15.  
  16. def connect(expr u, v)=
  17.   pair toward;
  18.   toward := unitvector (v - u);
  19.   toward := toward * 8 / abs(ypart toward);
  20.   draw (u+toward)--(v-toward);
  21. enddef;
  22.  
  23. beginfig(0)
  24.   pickup pencircle;
  25.   xs := 60;
  26.   ys := 30;
  27.   pair a[];
  28.   a0 := (0, 0) xscaled xs yscaled ys;
  29.   a1 := (-1, -1) xscaled xs yscaled ys;
  30.   a2 := (0, -1) xscaled xs yscaled ys;
  31.   a3 := (1, -1) xscaled xs yscaled ys;
  32.   a4 := (-2, -2) xscaled xs yscaled ys;
  33.   a5 := (-1, -2) xscaled xs yscaled ys;
  34.   a6 := (0, -2) xscaled xs yscaled ys;
  35.   a7 := (2, -2) xscaled xs yscaled ys;
  36.   a8 := (-2, -3) xscaled xs yscaled ys;
  37.   a9 := (0, -3) xscaled xs yscaled ys;
  38.   a10 := (2, -3) xscaled xs yscaled ys;
  39.   a11 := (-2, -4) xscaled xs yscaled ys;
  40.   a12 := (0, -4) xscaled xs yscaled ys;
  41.   a13 := (-2, -5) xscaled xs yscaled ys;
  42.   label(btex \(\mathit{Expression}\) etex, a0);
  43.   label(btex \(\mathit{Expression}\) etex, a1);
  44.   label(btex \(-\) etex, a2);
  45.   label(btex \(\mathit{Term}\) etex, a3);
  46.   label(btex \(\mathit{Expression}\) etex, a4);
  47.   label(btex \(-\) etex, a5);
  48.   label(btex \(\mathit{Term}\) etex, a6);
  49.   label(btex \(\mathit{Factor}\) etex, a7);
  50.   label(btex \(\mathit{Term}\) etex, a8);
  51.   label(btex \(\mathit{Factor}\) etex, a9);
  52.   label(btex \(\mathit{Integer}\) etex, a10);
  53.   label(btex \(\mathit{Factor}\) etex, a11);
  54.   label(btex \(\mathit{Integer}\) etex, a12);
  55.   label(btex \(\mathit{Integer}\) etex, a13);
  56.   connect(a0, a1);
  57.   connect(a0, a2);
  58.   connect(a0, a3);
  59.   connect(a1, a4);
  60.   connect(a1, a5);
  61.   connect(a1, a6);
  62.   connect(a3, a7);
  63.   connect(a4, a8);
  64.   connect(a6, a9);
  65.   connect(a7, a10);
  66.   connect(a8, a11);
  67.   connect(a9, a12);
  68.   connect(a11, a13);
  69. endfig;
  70.  
  71. bye;
  72. EOF
  73.  
  74. cat<<EOF > left-recursive-parse-of-a-double-subtraction.tex
  75. \documentclass{article}
  76. \usepackage[paperwidth=22cm,paperheight=13cm,text={22cm,13cm}]{geometry}
  77. \usepackage{graphicx}
  78. \pagestyle{empty}
  79. \begin{document}
  80. \hbox{}
  81. \centerline{\convertMPtoPDF{\jobname.0}{2}{2}}
  82. \end{document}
  83. EOF
  84.  
  85. mpost left-recursive-parse-of-a-double-subtraction
  86. pdflatex left-recursive-parse-of-a-double-subtraction
  87. convert left-recursive-parse-of-a-double-subtraction.pdf left-recursive-parse-of-a-double-subtraction.png
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top