Skip to content

Commit f0164ec

Browse files
Merge pull request #8 from virtual-labs/dev
Update procedure.md
2 parents 2a46928 + d9fa342 commit f0164ec

File tree

1 file changed

+122
-28
lines changed

1 file changed

+122
-28
lines changed

experiment/procedure.md

Lines changed: 122 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,124 @@
1+
## 1. Getting Started with Regular Expression Input
12

3+
### 1.1: Entering a Regular Expression
24

3-
1. **Enter Regular Expression**
4-
- Type a regular expression in the input field
5-
- Use the example buttons to try pre-defined expressions
6-
- Click "Start Construction" to begin
7-
8-
2. **Step-by-Step Construction**
9-
- Use "Next Step" and "Previous" buttons to navigate through the construction
10-
- Watch how each operator (|, *, +, ·) affects the NFA
11-
- Observe the stack of NFAs being built
12-
- Use "Auto Play" to see the construction automatically
13-
14-
3. **Understanding the NFA**
15-
- Green circle represents the start state
16-
- Red double circle represents accept state
17-
- Arrows show transitions with their labels
18-
- ε represents epsilon transitions
19-
20-
4. **Testing the NFA**
21-
- Enter a test string in the test section
22-
- Click "Test" to see if the string is accepted
23-
- Try different strings to understand the language
24-
25-
5. **Examples to Try**
26-
- Basic: "a", "b"
27-
- Union: "a|b"
28-
- Concatenation: "ab"
29-
- Star: "a*"
30-
- Complex: "(a|b)*abb"
5+
- Locate the "Enter RegEx" button in the main control panel
6+
- Click the button to open the input dialog
7+
- Type your desired regular expression in the text field that appears
8+
- Click "Start Construction" to begin the NFA conversion process
9+
10+
### 1.2: Using Example Expressions
11+
12+
- Click the "Examples" button to automatically load a pre-defined regular expression
13+
- The system will randomly select from available examples including: a*, a|b, ab, (a|b)*, (a|b)*abb, a+b*, (ab)*
14+
- This is particularly useful for beginners to understand different types of regular expressions
15+
16+
## 2. Navigating Through Thompson's Algorithm Construction
17+
18+
### 2.1: Understanding the Construction Process
19+
20+
- Once a regular expression is entered, the system displays the step-by-step construction using Thompson's Algorithm
21+
- The construction process is broken down into discrete steps, each showing a specific operation
22+
- A progress bar at the top indicates your current position in the construction sequence
23+
24+
### 2.2: Step Navigation Controls
25+
26+
- Use the "Next Step" button to advance to the subsequent construction step
27+
- Use the "Previous" button to return to earlier steps for review
28+
- Alternative navigation: Use the right arrow key (→) to move forward and left arrow key (←) to move backward
29+
- The step counter displays your current position (e.g., "3 / 8" means step 3 of 8 total steps)
30+
31+
### 2.3: Construction Steps Panel
32+
33+
- The right sidebar displays a detailed list of all construction steps
34+
- Each step is numbered and includes a descriptive title and explanation
35+
- The current step is highlighted for easy identification
36+
- Steps are marked as completed as you progress through the construction
37+
38+
## 3. Understanding the NFA Visualization
39+
40+
### 3.1: State Representation
41+
42+
- States are represented as circles with unique identifiers
43+
- The start state is indicated by an incoming arrow from the left
44+
- Accept states are shown as double circles (circle within a circle)
45+
- Currently active states during step navigation may be highlighted
46+
47+
### 3.2: Transition Interpretation
48+
49+
- Solid arrows represent character transitions labeled with the specific symbol
50+
- Dashed arrows represent epsilon (ε) transitions, which occur without consuming input
51+
- Multiple transitions from a state may curve to avoid overlap
52+
- Self-loops appear as curved arrows returning to the same state
53+
54+
### 3.3: Visual Layout
55+
56+
- The NFA diagram automatically adjusts its layout for optimal viewing
57+
- States are positioned to minimize crossing transitions
58+
- The visualization scales to fit within the display area
59+
60+
## 4. Testing the Constructed NFA
61+
62+
### 4.1: Accessing the Test Function
63+
64+
- After completing the construction, the test section becomes available in the right panel
65+
- Locate the "Test NFA" section at the bottom of the construction steps panel
66+
67+
### 4.2: String Testing Process
68+
69+
- Enter a test string in the input field labeled "Test string"
70+
- Click the "Test" button to verify if the string is accepted by the constructed NFA
71+
- The result will display as either "ACCEPTED" (in green) or "REJECTED" (in red)
72+
73+
### 4.3: Understanding Test Results
74+
75+
- An accepted string means the NFA reaches an accept state after processing all input characters
76+
- A rejected string means the NFA cannot reach an accept state with the given input
77+
- Test multiple strings to better understand the language recognized by your regular expression
78+
79+
## 5. Learning Through Different Expression Types
80+
81+
### 5.1: Basic Expressions
82+
83+
- Start with simple single character expressions like "a" or "b"
84+
- Observe how these create the most basic two-state NFAs
85+
86+
### 5.2: Union Operations
87+
88+
- Try expressions like "a|b" to understand how the union operator creates parallel paths
89+
- Notice how epsilon transitions connect the start state to multiple sub-expressions
90+
91+
### 5.3: Concatenation Operations
92+
93+
- Experiment with expressions like "ab" to see how concatenation connects NFAs in sequence
94+
- Observe how the accept state of the first NFA becomes connected to the start state of the second
95+
96+
### 5.4: Kleene Star Operations
97+
98+
- Test expressions like "a*" to understand how the star operator creates loops
99+
- Notice the epsilon transitions that allow for zero or more repetitions
100+
101+
### 5.5: Complex Expressions
102+
103+
- Try comprehensive expressions like "(a|b)*abb" that combine multiple operators
104+
- Follow the construction step-by-step to understand how complex expressions are built from simpler components
105+
106+
## 6. Best Practices for Learning
107+
108+
### 6.1: Systematic Exploration
109+
110+
- Begin with simple expressions and gradually increase complexity
111+
- Complete the entire construction process for each expression before moving to the next
112+
- Use the step navigation to review difficult concepts multiple times
113+
114+
### 6.2: Testing Comprehension
115+
116+
- After constructing an NFA, predict whether certain strings should be accepted before testing
117+
- Verify your predictions using the test function
118+
- If results differ from expectations, review the construction steps to understand why
119+
120+
### 6.3: Pattern Recognition
121+
122+
- Notice how certain regular expression patterns consistently produce similar NFA structures
123+
- Observe the relationship between expression complexity and the number of construction steps
124+
- Identify common sub-patterns that appear in multiple expressions

0 commit comments

Comments
 (0)