diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | design.svg | 293 |
2 files changed, 298 insertions, 1 deletions
@@ -25,7 +25,11 @@ The cute scheme compiler (like most compilers) consists of a number of phases that gradually transform a program from scheme code through numerous intermediate representations. The csc compiler has 3 such intermediate representations, not counting bytecode itself. These two -languages are creatively called IR1, IR2, and IR3. +languages are creatively called IR1, IR2, and IR3. Fig. 1 shows the +phases of code generation. + + ### IR1 diff --git a/design.svg b/design.svg new file mode 100644 index 0000000..d901be2 --- /dev/null +++ b/design.svg @@ -0,0 +1,293 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + width="1.7300283in" + height="2.7169535in" + viewBox="0 0 43.942721 69.01062" + version="1.1" + id="svg5" + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" + sodipodi:docname="design.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <sodipodi:namedview + id="namedview7" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:document-units="mm" + showgrid="true" + inkscape:snap-grids="true" + inkscape:zoom="0.77771465" + inkscape:cx="275.8081" + inkscape:cy="380.60232" + inkscape:window-width="1873" + inkscape:window-height="2098" + inkscape:window-x="30" + inkscape:window-y="30" + inkscape:window-maximized="1" + inkscape:current-layer="layer1" + units="in" + width="6.12164in" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0"> + <inkscape:grid + type="xygrid" + id="grid5198" + originx="-47.514151" + originy="-47.51414" /> + </sodipodi:namedview> + <defs + id="defs2"> + <marker + style="overflow:visible" + id="Arrow1Lend" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lend" + inkscape:isstock="true"> + <path + transform="matrix(-0.8,0,0,-0.8,-10,0)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path9927" /> + </marker> + <marker + style="overflow:visible" + id="DotL" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="DotL" + inkscape:isstock="true"> + <path + transform="matrix(0.8,0,0,0.8,5.92,0.8)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" + id="path9985" /> + </marker> + <marker + style="overflow:visible" + id="Arrow1Send" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Send" + inkscape:isstock="true"> + <path + transform="matrix(-0.2,0,0,-0.2,-1.2,0)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path9939" /> + </marker> + <marker + style="overflow:visible" + id="marker10202" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart" + inkscape:isstock="true"> + <path + transform="matrix(0.8,0,0,0.8,10,0)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path10200" /> + </marker> + <marker + style="overflow:visible" + id="Arrow2Lend" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Lend" + inkscape:isstock="true"> + <path + transform="matrix(-1.1,0,0,-1.1,-1.1,0)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:0.625;stroke-linejoin:round" + id="path9945" /> + </marker> + <marker + style="overflow:visible" + id="Arrow1Lstart" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow1Lstart" + inkscape:isstock="true"> + <path + transform="matrix(0.8,0,0,0.8,10,0)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 0,0 5,-5 -12.5,0 5,5 Z" + id="path9924" /> + </marker> + </defs> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-47.514141,-47.514141)"> + <rect + style="fill:#610089;fill-opacity:0.181042;fill-rule:evenodd;stroke:#000000;stroke-width:0.221719;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect1098" + width="26.918482" + height="7.4773545" + x="47.625" + y="47.625" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="50.931828" + y="52.610332" + id="text3016"><tspan + sodipodi:role="line" + id="tspan3014" + style="stroke-width:0.0747733" + x="50.931828" + y="52.610332">Scheme code</tspan></text> + <rect + style="fill:#008100;fill-opacity:0.181042;stroke:#000000;stroke-width:0.168392;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect5196" + width="10.468298" + height="7.477356" + x="55.102356" + y="62.579704" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="58.068321" + y="67.442688" + id="text7815"><tspan + sodipodi:role="line" + id="tspan7813" + style="stroke-width:0.0747733" + x="58.068321" + y="67.442688">IR1</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.216195;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 61.08424,55.102355 v 7.477357" + id="path9922" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="62.250111" + y="59.408424" + id="text12824"><tspan + sodipodi:role="line" + id="tspan12822" + style="stroke-width:0.0747733" + x="62.250111" + y="59.408424">Macro expander</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.216195;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 61.08424,70.057066 c 0,8.972825 0,8.972825 0,8.972825" + id="path13599" /> + <rect + style="fill:#008100;fill-opacity:0.181042;stroke:#000000;stroke-width:0.216195;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect13711" + width="10.468298" + height="7.477355" + x="55.102356" + y="79.029892" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="57.943123" + y="83.74025" + id="text16509"><tspan + sodipodi:role="line" + id="tspan16507" + style="stroke-width:0.0747733" + x="57.943123" + y="83.74025">IR2</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="62.754745" + y="75.154015" + id="text20971"><tspan + sodipodi:role="line" + id="tspan20969" + style="stroke-width:0.0747733" + x="62.754745" + y="75.154015">CPS conversion</tspan></text> + <path + style="fill:#008100;fill-opacity:0.181042;stroke:#000000;stroke-width:0.216195;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 61.08424,86.507247 c 0,8.972828 0,8.972828 0,8.972828" + id="path25182" /> + <rect + style="fill:#008100;fill-opacity:0.181042;stroke:#000000;stroke-width:0.216195;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect25206" + width="10.468298" + height="7.477355" + x="55.102356" + y="95.480072" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="57.837982" + y="100.01888" + id="text27806"><tspan + sodipodi:role="line" + id="tspan27804" + style="stroke-width:0.0747733" + x="57.837982" + y="100.01888">IR3</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="63.228497" + y="91.630066" + id="text32058"><tspan + sodipodi:role="line" + id="tspan32056" + style="stroke-width:0.0747733" + x="63.228497" + y="91.630066">Closure conversion</tspan></text> + <rect + style="fill:#9e0000;fill-opacity:0.181042;stroke:#000000;stroke-width:0.216195;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect32522" + width="23.927536" + height="5.981884" + x="49.120472" + y="110.43478" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="54.230087" + y="114.60877" + id="text34462"><tspan + sodipodi:role="line" + id="tspan34460" + style="stroke-width:0.0747733" + x="54.230087" + y="114.60877">Bytecode</tspan></text> + <path + style="fill:#9e0000;fill-opacity:0.181042;stroke:#000000;stroke-width:0.216195;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="m 61.08424,102.95743 v 7.47736" + id="path36125" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:2.99093px;line-height:1.25;font-family:sans-serif;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.0747733" + x="62.319099" + y="107.33462" + id="text39894"><tspan + sodipodi:role="line" + id="tspan39892" + style="stroke-width:0.0747733" + x="62.319099" + y="107.33462">Code generation</tspan></text> + </g> +</svg> |
