mirror of
https://github.com/RustyRaptor/compilers.git
synced 2026-12-03 15:15:17 -07:00
fixed last question of HW
This commit is contained in:
1 parent
c4fb8fb4f8
commit
f4908d8334
6 files changed
+58
-14
No files matched your search
+42
-10
@@ -351,16 +351,48 @@ pre[data-line] .line-highlight[data-end]:after {
|
||||
|
||||
<h4 class="mume-header" id="a-1">a</h4>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>a</mi><mi mathvariant="normal">∣</mi><mi>b</mi></mrow><annotation encoding="application/x-tex">a|b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">a</span><span class="mord">∣</span><span class="mord mathnormal">b</span></span></span></span><br>
|
||||
<img src="thompson1.png" alt="step 1"></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>a</mi><mi mathvariant="normal">∣</mi><mi>b</mi><mo stretchy="false">)</mo><mo>∗</mo></mrow><annotation encoding="application/x-tex">(a|b)*</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">a</span><span class="mord">∣</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mord">∗</span></span></span></span><br>
|
||||
<img src="thompson2.png" alt="step 2"></p>
|
||||
</li>
|
||||
</ul>
|
||||
<h5 class="mume-header" id="nfa-ab">NFA <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>a</mi><mi mathvariant="normal">∣</mi><mi>b</mi><mo stretchy="false">)</mo><mo>∗</mo></mrow><annotation encoding="application/x-tex">(a|b)*</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">a</span><span class="mord">∣</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mord">∗</span></span></span></span></h5>
|
||||
|
||||
<p><img src="thompson2.png" alt="step 2"></p>
|
||||
<h5 class="mume-header" id="transition-table">Transition Table</h5>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>State</th>
|
||||
<th>a</th>
|
||||
<th>b</th>
|
||||
<th>a + <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ϵ</mi></mrow><annotation encoding="application/x-tex">\epsilon</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">ϵ</span></span></span></span></th>
|
||||
<th>b + <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ϵ</mi></mrow><annotation encoding="application/x-tex">\epsilon</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">ϵ</span></span></span></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>X: {1,2,3,6}</td>
|
||||
<td>{4}</td>
|
||||
<td>{7}</td>
|
||||
<td>{4,3,2,6,8}</td>
|
||||
<td>{7,3,2,6,8}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Y: {4,3,2,6,8}</td>
|
||||
<td>{4}</td>
|
||||
<td>{7}</td>
|
||||
<td>{4,3,2,6,8}</td>
|
||||
<td>{7,3,2,6,8}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Z: {7,3,2,6,8}</td>
|
||||
<td>{4}</td>
|
||||
<td>{7}</td>
|
||||
<td>{4,3,2,6,8}</td>
|
||||
<td>{7,3,2,6,8}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h5 class="mume-header" id="dfa">DFA</h5>
|
||||
|
||||
<p><img src="thompson1.png" alt="A"></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
+16
-4
@@ -32,8 +32,20 @@ $$0 \Rightarrow (\epsilon) 3 \Rightarrow (\epsilon) 2 \Rightarrow (\epsilon) 1 \
|
||||
|
||||
### 3.7.3
|
||||
#### a
|
||||
- $a|b$
|
||||

|
||||
|
||||
- $(a|b)*$
|
||||

|
||||
##### NFA $(a|b)*$
|
||||
|
||||

|
||||
|
||||
##### Transition Table
|
||||
|
||||
| State | a | b | a + $\epsilon$ | b + $\epsilon$ |
|
||||
|----------------|-----|-----|-------------------|-------------------|
|
||||
| X: {1,2,3,6} | {4} | {7} | {4,3,2,6,8} | {7,3,2,6,8} |
|
||||
| Y: {4,3,2,6,8} | {4} | {7} | {4,3,2,6,8} | {7,3,2,6,8} |
|
||||
| Z: {7,3,2,6,8} | {4} | {7} | {4,3,2,6,8} | {7,3,2,6,8} |
|
||||
|
||||
|
||||
##### DFA
|
||||
|
||||

|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 68 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 81 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Reference in new issue
Block a user