Skip to content

Commit a34e4e0

Browse files
Merge pull request #17 from virtual-labs/dev
Merge dev to testing
2 parents 1c1668e + dc7e460 commit a34e4e0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

experiment/theory.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Thompson's algorithm follows these specific construction patterns:
106106
**1. Base Case - Single Symbol 'a':**
107107

108108
```text
109+
109110
┌────────┐ a ┌────────┐
110111
→│ q₀ │ ───────────────> │ q₁ │ ◎
111112
└────────┘ └────────┘
@@ -121,8 +122,9 @@ This creates a simple two-state NFA where:
121122
**2. Concatenation - Expressions r₁r₂:**
122123

123124
```text
125+
124126
┌──────────┐ ┌──────────┐
125-
→ │ NFA₁ │ │ NFA₂ │ ◎
127+
→ │ NFA₁ │ │ NFA₂ │ ◎
126128
│ (r₁) │ │ (r₂) │
127129
└──────────┘ └──────────┘
128130
│ ↑
@@ -144,6 +146,7 @@ Construction steps:
144146
**3. Union - Expressions r₁|r₂:**
145147

146148
```text
149+
147150
ε ┌──────────┐ ε
148151
┌─────────> │ NFA₁ │ ─────────┐
149152
│ │ (r₁) │ │
@@ -165,6 +168,7 @@ Construction steps:
165168
**4. Kleene Star - Expression r*:**
166169

167170
```text
171+
168172
┌─────── ε (skip) ─────────┐
169173
│ │
170174
↓ ↓
@@ -189,6 +193,7 @@ Construction steps:
189193
**5. Plus Operation - Expression r+:**
190194

191195
```text
196+
192197
┌────┐ ┌──────────┐ ┌────┐
193198
→ │ q₀ │ ──────> │ NFA │ ──────> │ qf │ ◎
194199
└────┘ ε │ (r) │ ε └────┘
@@ -220,12 +225,14 @@ Let's convert the regular expression `(a|b)*abb` to an NFA:
220225
2. **Build NFA for 'b'**: Simple two-state NFA
221226

222227
```text
228+
223229
→ (q₂) ─b→ (q₃)
224230
```
225231

226232
3. **Build NFA for 'a|b'**: Use union construction
227233

228234
```text
235+
229236
ε ─a→
230237
┌───→ ( ) ───┐ ε
231238
→ ( ) │ ├──→ ( )
@@ -236,6 +243,7 @@ Let's convert the regular expression `(a|b)*abb` to an NFA:
236243
4. **Build NFA for '(a|b)*'**: Apply Kleene star construction
237244

238245
```text
246+
239247
┌──────ε──────┐
240248
│ ↓
241249
→ ( ) ┴──ε→ [a|b] ──┴─ε→ ( )
@@ -246,12 +254,14 @@ Let's convert the regular expression `(a|b)*abb` to an NFA:
246254
5. **Build NFAs for 'a', 'b', 'b'**: Simple constructions
247255

248256
```text
257+
249258
→ ( ) ─a→ ( ) → ( ) ─b→ ( ) → ( ) ─b→ ( ) ◎
250259
```
251260

252261
6. **Concatenate all parts**: Final NFA for `(a|b)*abb`
253262

254263
```text
264+
255265
→ [(a|b)*] ─ε→ [a] ─ε→ [b] ─ε→ [b] ◎
256266
```
257267

0 commit comments

Comments
 (0)