summaryrefslogtreecommitdiff
path: root/chapter01/docs/01-graph.svg
diff options
context:
space:
mode:
authorDibyendu Majumdar <dibyendumajumdar@users.noreply.github.com>2023-09-26 17:43:36 +0100
committerGitHub <noreply@github.com>2023-09-26 09:43:36 -0700
commit29def92f2ddbfca64ba827f116172fe98b2df491 (patch)
treea49affb27d57e908429beafe300756d5e4c0c273 /chapter01/docs/01-graph.svg
parent62bfd0d619b28892152a7d89639f3437bc9df573 (diff)
downloadSimple-29def92f2ddbfca64ba827f116172fe98b2df491.tar.gz
Simple-29def92f2ddbfca64ba827f116172fe98b2df491.zip
Chapter 2 (#4)
* Start on Chapter 2. * Start on Chapter 2. * Refactor * Refactor * Initial attempt at peephole opt for add operation * cleanup unused import * Start on graph visualizer * Start on graph visualizer * Rework chapter 2 Add a short discourse on the Types, and provide a Bottom type. Make a final toString; require each Node to specify its special printing via label(). Add a recursing printer called print(); toString is used by default in the debugger and so cannot be recursive. Make the peephole rules based on a proper Type and idealize calls. Big comments about the Type computations. Every node picks up a _print, compute and idealize() call. Rename long arith ops Divide, UnaryMinus, Multiply, Subtract into shorter uniform-length names. Cleans up the parser where he does the precedence op parsing. Rework Parser: - Drop Token class, its all Strings except in the one place we know a number is coming - Embed the Lexer as a field in the Parser, instead of trying to pass it around everywhere in the Parser - StartNode becomes a read-only global, so we don't have to pass it around everywhere in the Parser AND optimizer. - Lexer matches on strings and returns strings. Match and consume *at the moment* instead of carrying around a current token/string and forcing the next-token after consuming the current one. - All parse subexpressions shrink by 1/2 after these changes. * Initial writeup of Chapter 2 * Initial writeup of Chapter 2 * Initial writeup of Chapter 2 * Initial writeup of Chapter 2 * Remove range * progress Chapter 2 Drop integer ranges. Broader lattice pic. Lots of prose changes in the readme. Fixed title in gviz dot generation. Fixed bug with peephole making redundant constants. * Implement compute for all the arithmetic node types Add a flag to switch off peephole so we can see the full graph Add post peephole graph to writeup * Implement compute for all the arithmetic node types Add a flag to switch off peephole so we can see the full graph Add post peephole graph to writeup * Fix bad path to the svg * Update pre-peephole diagram * Add dead code elimination ...and a set_def to proper update graph edges. * Update README.md * Cleanup the GraphVisualizer a bit. Update the graphs. Update the chapter list as chapter 3 deleted, and chapter 4 is now chapter 3. --------- Co-authored-by: Cliff Click <cliffc@acm.org>
Diffstat (limited to 'chapter01/docs/01-graph.svg')
-rw-r--r--chapter01/docs/01-graph.svg43
1 files changed, 43 insertions, 0 deletions
diff --git a/chapter01/docs/01-graph.svg b/chapter01/docs/01-graph.svg
new file mode 100644
index 00000000..fbf92d7d
--- /dev/null
+++ b/chapter01/docs/01-graph.svg
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.43.0 (0)
+ -->
+<!-- Title: chapter01 Pages: 1 -->
+<svg width="204pt" height="116pt"
+ viewBox="0.00 0.00 203.74 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
+<title>chapter01</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 199.74,-112 199.74,4 -4,4"/>
+<!-- start -->
+<g id="node1" class="node">
+<title>start</title>
+<polygon fill="none" stroke="black" points="54,-108 0,-108 0,-72 54,-72 54,-108"/>
+<text text-anchor="middle" x="27" y="-86.3" font-family="Times,serif" font-size="14.00">Start</text>
+</g>
+<!-- return -->
+<g id="node3" class="node">
+<title>return</title>
+<polygon fill="none" stroke="black" points="113,-36 47,-36 47,0 113,0 113,-36"/>
+<text text-anchor="middle" x="80" y="-14.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- start&#45;&gt;return -->
+<g id="edge2" class="edge">
+<title>start&#45;&gt;return</title>
+<path fill="none" stroke="red" stroke-width="2" d="M40.1,-71.7C46.39,-63.39 54.05,-53.28 60.96,-44.14"/>
+<polygon fill="red" stroke="red" stroke-width="2" points="63.8,-46.19 67.05,-36.1 58.22,-41.96 63.8,-46.19"/>
+</g>
+<!-- constant -->
+<g id="node2" class="node">
+<title>constant</title>
+<ellipse fill="none" stroke="black" cx="134" cy="-90" rx="61.99" ry="18"/>
+<text text-anchor="middle" x="134" y="-86.3" font-family="Times,serif" font-size="14.00">Constant 1</text>
+</g>
+<!-- constant&#45;&gt;return -->
+<g id="edge1" class="edge">
+<title>constant&#45;&gt;return</title>
+<path fill="none" stroke="black" d="M120.93,-72.05C114.52,-63.75 106.68,-53.58 99.58,-44.38"/>
+<polygon fill="black" stroke="black" points="102.21,-42.06 93.33,-36.28 96.66,-46.33 102.21,-42.06"/>
+</g>
+</g>
+</svg>