Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitf53f28c22e58844a90cdf00700cec325cfb7be53 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-04-17 09:24:52 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-04-17 09:24:52 +0300
Filesbeca0752610cc7adcdbf8ab9d09ffe175a6edc19
syndamia.com-f53f28c22e58844a90cdf00700cec325cfb7be53.tar
syndamia.com-f53f28c22e58844a90cdf00700cec325cfb7be53.tar.gz
syndamia.com-f53f28c22e58844a90cdf00700cec325cfb7be53.zip
Parent1345e120c9f8e3bcf2524c8c9ba382f3f92a544c (diff)
[blog/seoc] Finished AST section
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-1.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-1.svg
new file mode 100644
index 0000000..174f003
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-1.svg
@@ -0,0 +1,26 @@
+<svg version="1.1" baseProfile="full" width="81.0" height="87.0" viewbox="0 0 81 87" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [2]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="87.0" width="81.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)">
+ <g data-name="2">
+ <g fill="#eee8d5" stroke="#33322E" data-name="2">
+ <rect x="0.0" y="0.0" height="31.0" width="25.0" data-name="2"></rect>
+ </g>
+ <g transform="translate(0, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="2">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="2">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="2">2</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-2.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-2.svg
new file mode 100644
index 0000000..48e2636
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-2.svg
@@ -0,0 +1,53 @@
+<svg version="1.1" baseProfile="full" width="150.0" height="158.0" viewbox="0 0 150 158" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [*]-&gt;[2]
+ [*]-&gt;[&lt;abstract&gt;...]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="158.0" width="150.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M35.0 27.2 L12.5 51 L12.5 64.33333333333333 L12.5 64.3 " fill="none"></path>
+ <path d="M7.2 57.7 L12.5 64.3 L17.8 57.7 L12.5 71.0 Z"></path>
+ <path d="M57.0 27.2 L79.5 51 L79.5 64.33333333333333 L79.5 64.3 " fill="none"></path>
+ <path d="M74.2 57.7 L79.5 64.3 L84.8 57.7 L79.5 71.0 Z"></path>
+ <g data-name="*">
+ <g fill="#eee8d5" stroke="#33322E" data-name="*">
+ <rect x="35.0" y="0.0" height="31.0" width="22.0" data-name="*"></rect>
+ </g>
+ <g transform="translate(35, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="*">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="*">
+ <text x="3.0" y="13.5" stroke="none" text-anchor="middle" data-name="*">*</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="2">
+ <g fill="#eee8d5" stroke="#33322E" data-name="2">
+ <rect x="0.0" y="71.0" height="31.0" width="25.0" data-name="2"></rect>
+ </g>
+ <g transform="translate(0, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="2">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="2">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="2">2</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="...">
+ <g fill="#eee8d5" stroke="#33322E" data-name="...">
+ <rect x="65.0" y="71.0" height="31.0" width="29.0" data-name="..."></rect>
+ </g>
+ <g transform="translate(65, 71)" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="italic" data-name="...">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="...">
+ <text x="6.5" y="13.5" stroke="none" text-anchor="middle" data-name="...">...</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-3.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-3.svg
new file mode 100644
index 0000000..ea526df
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-3.svg
@@ -0,0 +1,53 @@
+<svg version="1.1" baseProfile="full" width="148.0" height="158.0" viewbox="0 0 148 158" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [*]-&gt;[2]
+ [*]-&gt;[()]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="158.0" width="148.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M34.5 27.3 L12.5 51 L12.5 64.33333333333333 L12.5 64.3 " fill="none"></path>
+ <path d="M7.2 57.7 L12.5 64.3 L17.8 57.7 L12.5 71.0 Z"></path>
+ <path d="M56.5 27.3 L78.5 51 L78.5 64.33333333333333 L78.5 64.3 " fill="none"></path>
+ <path d="M73.2 57.7 L78.5 64.3 L83.8 57.7 L78.5 71.0 Z"></path>
+ <g data-name="*">
+ <g fill="#eee8d5" stroke="#33322E" data-name="*">
+ <rect x="34.5" y="0.0" height="31.0" width="22.0" data-name="*"></rect>
+ </g>
+ <g transform="translate(34.5, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="*">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="*">
+ <text x="3.0" y="13.5" stroke="none" text-anchor="middle" data-name="*">*</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="2">
+ <g fill="#eee8d5" stroke="#33322E" data-name="2">
+ <rect x="0.0" y="71.0" height="31.0" width="25.0" data-name="2"></rect>
+ </g>
+ <g transform="translate(0, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="2">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="2">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="2">2</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="()">
+ <g fill="#eee8d5" stroke="#33322E" data-name="()">
+ <rect x="65.0" y="71.0" height="31.0" width="27.0" data-name="()"></rect>
+ </g>
+ <g transform="translate(65, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="()">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="()">
+ <text x="5.5" y="13.5" stroke="none" text-anchor="middle" data-name="()">()</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-ex1.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-ex1.svg
new file mode 100644
index 0000000..d5addd2
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-ex1.svg
@@ -0,0 +1,39 @@
+<svg version="1.1" baseProfile="full" width="85.0" height="158.0" viewbox="0 0 85 158" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [()]-&gt;[&lt;abstract&gt;...]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="158.0" width="85.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M14.5 31.0 L14.5 51 L14.5 64.33333333333333 L14.5 64.3 " fill="none"></path>
+ <path d="M9.2 57.7 L14.5 64.3 L19.8 57.7 L14.5 71.0 Z"></path>
+ <g data-name="()">
+ <g fill="#eee8d5" stroke="#33322E" data-name="()">
+ <rect x="1.0" y="0.0" height="31.0" width="27.0" data-name="()"></rect>
+ </g>
+ <g transform="translate(1, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="()">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="()">
+ <text x="5.5" y="13.5" stroke="none" text-anchor="middle" data-name="()">()</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="...">
+ <g fill="#eee8d5" stroke="#33322E" data-name="...">
+ <rect x="0.0" y="71.0" height="31.0" width="29.0" data-name="..."></rect>
+ </g>
+ <g transform="translate(0, 71)" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="italic" data-name="...">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="...">
+ <text x="6.5" y="13.5" stroke="none" text-anchor="middle" data-name="...">...</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-ex2.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-ex2.svg
new file mode 100644
index 0000000..fcf84a1
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-ex2.svg
@@ -0,0 +1,67 @@
+<svg version="1.1" baseProfile="full" width="158.0" height="229.0" viewbox="0 0 158 229" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [*]-&gt;[()]
+ [*]-&gt;[&lt;abstract&gt;....]
+ [()]-&gt;[&lt;abstract&gt;...]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="229.0" width="158.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M38.8 26.6 L14.5 51 L14.5 64.33333333333333 L14.5 64.3 " fill="none"></path>
+ <path d="M9.2 57.7 L14.5 64.3 L19.8 57.7 L14.5 71.0 Z"></path>
+ <path d="M60.8 26.6 L85 51 L85 64.33333333333333 L85.0 64.3 " fill="none"></path>
+ <path d="M79.7 57.7 L85.0 64.3 L90.3 57.7 L85.0 71.0 Z"></path>
+ <path d="M14.5 102.0 L14.5 122 L14.5 135.33333333333334 L14.5 135.3 " fill="none"></path>
+ <path d="M9.2 128.7 L14.5 135.3 L19.8 128.7 L14.5 142.0 Z"></path>
+ <g data-name="*">
+ <g fill="#eee8d5" stroke="#33322E" data-name="*">
+ <rect x="38.8" y="0.0" height="31.0" width="22.0" data-name="*"></rect>
+ </g>
+ <g transform="translate(38.75, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="*">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="*">
+ <text x="3.0" y="13.5" stroke="none" text-anchor="middle" data-name="*">*</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="()">
+ <g fill="#eee8d5" stroke="#33322E" data-name="()">
+ <rect x="1.0" y="71.0" height="31.0" width="27.0" data-name="()"></rect>
+ </g>
+ <g transform="translate(1, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="()">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="()">
+ <text x="5.5" y="13.5" stroke="none" text-anchor="middle" data-name="()">()</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="....">
+ <g fill="#eee8d5" stroke="#33322E" data-name="....">
+ <rect x="68.0" y="71.0" height="31.0" width="34.0" data-name="...."></rect>
+ </g>
+ <g transform="translate(68, 71)" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="italic" data-name="....">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="....">
+ <text x="9.0" y="13.5" stroke="none" text-anchor="middle" data-name="....">....</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="...">
+ <g fill="#eee8d5" stroke="#33322E" data-name="...">
+ <rect x="0.0" y="142.0" height="31.0" width="29.0" data-name="..."></rect>
+ </g>
+ <g transform="translate(0, 142)" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="italic" data-name="...">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="...">
+ <text x="6.5" y="13.5" stroke="none" text-anchor="middle" data-name="...">...</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-ex3.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-ex3.svg
new file mode 100644
index 0000000..d15267e
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-ex3.svg
@@ -0,0 +1,53 @@
+<svg version="1.1" baseProfile="full" width="146.0" height="158.0" viewbox="0 0 146 158" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [+]-&gt;[1]
+ [+]-&gt;[2]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="158.0" width="146.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M32.5 29.2 L12.5 51 L12.5 64.33333333333333 L12.5 64.3 " fill="none"></path>
+ <path d="M7.2 57.7 L12.5 64.3 L17.8 57.7 L12.5 71.0 Z"></path>
+ <path d="M57.5 29.2 L77.5 51 L77.5 64.33333333333333 L77.5 64.3 " fill="none"></path>
+ <path d="M72.2 57.7 L77.5 64.3 L82.8 57.7 L77.5 71.0 Z"></path>
+ <g data-name="+">
+ <g fill="#eee8d5" stroke="#33322E" data-name="+">
+ <rect x="32.5" y="0.0" height="31.0" width="25.0" data-name="+"></rect>
+ </g>
+ <g transform="translate(32.5, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="+">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="+">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="+">+</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="1">
+ <g fill="#eee8d5" stroke="#33322E" data-name="1">
+ <rect x="0.0" y="71.0" height="31.0" width="25.0" data-name="1"></rect>
+ </g>
+ <g transform="translate(0, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="1">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="1">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="1">1</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="2">
+ <g fill="#eee8d5" stroke="#33322E" data-name="2">
+ <rect x="65.0" y="71.0" height="31.0" width="25.0" data-name="2"></rect>
+ </g>
+ <g transform="translate(65, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="2">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="2">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="2">2</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/img/tree-building-ex4.svg b/src/blog/sane-explanation-of-compilers/img/tree-building-ex4.svg
new file mode 100644
index 0000000..7642a42
--- /dev/null
+++ b/src/blog/sane-explanation-of-compilers/img/tree-building-ex4.svg
@@ -0,0 +1,81 @@
+<svg version="1.1" baseProfile="full" width="180.0" height="229.0" viewbox="0 0 180 229" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
+ <desc >#background: #fdf6e3
+ [+]-&gt;[1]
+ [+]-&gt;[*]
+ [*]-&gt;[2]
+ [*]-&gt;[&lt;abstract&gt;...]</desc>
+ <g stroke-width="1.0" text-align="left" font="12pt Helvetica, Arial, sans-serif" font-size="12pt" font-family="Helvetica" font-weight="bold" font-style="normal">
+ <g font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" stroke-width="3.0" stroke-linejoin="round" stroke-linecap="round" stroke="#33322E">
+ <g stroke="transparent" fill="#fdf6e3">
+ <rect x="0.0" y="0.0" height="229.0" width="180.0" stroke="none"></rect>
+ </g>
+ <g transform="translate(8, 8)" fill="#33322E">
+ <g transform="translate(20, 20)" fill="#33322E" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="normal">
+ <path d="M31.8 29.5 L12.5 51 L12.5 64.33333333333333 L12.5 64.3 " fill="none"></path>
+ <path d="M7.2 57.7 L12.5 64.3 L17.8 57.7 L12.5 71.0 Z"></path>
+ <path d="M56.8 29.5 L76 51 L76 64.33333333333333 L76.0 64.3 " fill="none"></path>
+ <path d="M70.7 57.7 L76.0 64.3 L81.3 57.7 L76.0 71.0 Z"></path>
+ <path d="M65.0 98.2 L42.5 122 L42.5 135.33333333333334 L42.5 135.3 " fill="none"></path>
+ <path d="M37.2 128.7 L42.5 135.3 L47.8 128.7 L42.5 142.0 Z"></path>
+ <path d="M87.0 98.2 L109.5 122 L109.5 135.33333333333334 L109.5 135.3 " fill="none"></path>
+ <path d="M104.2 128.7 L109.5 135.3 L114.8 128.7 L109.5 142.0 Z"></path>
+ <g data-name="+">
+ <g fill="#eee8d5" stroke="#33322E" data-name="+">
+ <rect x="31.8" y="0.0" height="31.0" width="25.0" data-name="+"></rect>
+ </g>
+ <g transform="translate(31.75, 0)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="+">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="+">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="+">+</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="1">
+ <g fill="#eee8d5" stroke="#33322E" data-name="1">
+ <rect x="0.0" y="71.0" height="31.0" width="25.0" data-name="1"></rect>
+ </g>
+ <g transform="translate(0, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="1">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="1">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="1">1</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="*">
+ <g fill="#eee8d5" stroke="#33322E" data-name="*">
+ <rect x="65.0" y="71.0" height="31.0" width="22.0" data-name="*"></rect>
+ </g>
+ <g transform="translate(65, 71)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="*">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="*">
+ <text x="3.0" y="13.5" stroke="none" text-anchor="middle" data-name="*">*</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="2">
+ <g fill="#eee8d5" stroke="#33322E" data-name="2">
+ <rect x="30.0" y="142.0" height="31.0" width="25.0" data-name="2"></rect>
+ </g>
+ <g transform="translate(30, 142)" font-family="Helvetica" font-size="12pt" font-weight="bold" font-style="normal" data-name="2">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="2">
+ <text x="4.5" y="13.5" stroke="none" text-anchor="middle" data-name="2">2</text>
+
+ </g>
+ </g>
+ </g>
+ <g data-name="...">
+ <g fill="#eee8d5" stroke="#33322E" data-name="...">
+ <rect x="95.0" y="142.0" height="31.0" width="29.0" data-name="..."></rect>
+ </g>
+ <g transform="translate(95, 142)" font-family="Helvetica" font-size="12pt" font-weight="normal" font-style="italic" data-name="...">
+ <g transform="translate(8, 8)" fill="#33322E" text-align="center" data-name="...">
+ <text x="6.5" y="13.5" stroke="none" text-anchor="middle" data-name="...">...</text>
+
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </svg> \ No newline at end of file
diff --git a/src/blog/sane-explanation-of-compilers/part-1.md b/src/blog/sane-explanation-of-compilers/part-1.md
index 282d315..e847bc3 100644
--- a/src/blog/sane-explanation-of-compilers/part-1.md
+++ b/src/blog/sane-explanation-of-compilers/part-1.md
@@ -598,7 +598,7 @@ It all boils down to using a whole bunch of conditional statements and tracing w
And so on, we continue.
As you can see, we go back and forth, from 3 to 4, back to 3, then to 2, back to 3, then to 5.
- This way we avoid doing different things on different states.
+ This way we avoid doing different things on different states and we don't need to store the whole string, only the last few characters.
Additionally, in the real world nobody makes this table by hand, it is generated by a program, and this method makes table generation easier.
- As for the complete table, you can view it on the [Context Free Grammar Checker](https://smlweb.cpsc.ucalgary.ca/lr0.php?grammar=S+-%3E+F+%7C+%28+S+%2B+F+%29.%0AF+-%3E+a.&substs=) by [](TODO),
@@ -670,15 +670,62 @@ as
![](./img/tree-if.svg)
-And trust me, we can represent the whole code structure with a tree.
-Now, compilers are made in low-level languages like C++, so we need to think about the data type of each node (element) in our tree.
-We'll definetly need [object polymorphism](https://en.wikipedia.org/wiki/Subtyping#Examples) to be able to represent different nodes.
+You might ask how we generate the tree, and the answer is simple: on every step we add nodes to the tree, depending on the situation.
+Let's look at a familiar example:
-At a later stage we'll need to be running/evaluating the whole code with this tree, so how are we going to work with it?
-When we navigate to the node `<`, we'll do "if left element is less than right, do body when true, otherwise do body when false" but are we going to implement every single operator and language feature by hand?
-Or alteratively we could have a virtual method "evaluate" which changes
+```grammar
+N -> 1 | 2 | 3
+E -> N | (E) | E + E | E * E
+```
+
+Let's look at the input string `2 * (1 + 3)`, while abstracting ourselves from any particular algorithm:
+
+- we read the `2`, that is a number, we add it as a node
+
+ ![](./img/tree-building-1.svg)
+
+- then we read the `*`, we now know our expression is in the form `E * E`.
+ If you think about it, up to this point, we've basically been building a tree for the left handside.
+
+ **If** the topmost element in that tree is a brace,
+
+ ![](./img/tree-building-ex1.svg)
+
+ we connect it to the left handside of `*`:
+
+ ![](./img/tree-building-ex2.svg)
+
+ **Otherwise** (when it's `+` or `*` or a number), because of precedence, we'll attach the latest number to the left handside.
+ However we have to be careful, if something connects to the number, we now need it to connect to the `*`.
+ For example, let's say we had `1 + 2 * 3`, and we've just read the `*`.
+ The tree up to this point would look like,
+
+ ![](./img/tree-building-ex3.svg)
+
+ where the latest number we've found was `2`, but the `+` connects to it.
+ So, we need to make the `2` connect to the left handside of `*`, and make `+` connect to `*` instead of `2`
+
+ ![](./img/tree-building-ex4.svg)
+
+ In our original case, nothing connects to the `2` in `2 * (1 + 3)`, so we can just connect it to the left handside of `*`
+
+ ![](./img/tree-building-2.svg)
+
+ where the three dots singify there isn't anything there (but we expect there to be).
+ Somewhere we'll store that the next element we find has to be connected to the right handside.
+
+- now we read `(`, we cannot have it by itself, so we directly decide we're working with `(E)` (in our full algorithm we would need a check for existance of matching brace).
+ We'll create a `()` node and because of the last step, we'll connect it to the right handside.
+
+ ![](./img/tree-building-3.svg)
+
+ Now, moving forward, we'll be creating a subtree, essentially making a second tree, and after that is done, we'll connect it's topmost element (root) to the `()` node.
+
+- and so on.
+The overall algorithm is to add and change nodes every time you match something with a grammar rule, and the adding and changing is done, depending on the language, the current structure and so on.
+When discussing the middle and back-end layers, we'll talk about how to work with a generated AST, but for now your clue is the [visitor pattern](https://en.wikipedia.org/wiki/Visitor_pattern).
### Implementing a front-end