Skip to content

Commit 1d4e8e3

Browse files
authored
Merge pull request #5 from virtual-labs/dev
Dev
2 parents 3701bda + a35da27 commit 1d4e8e3

File tree

20 files changed

+1699
-1919
lines changed

20 files changed

+1699
-1919
lines changed

experiment-descriptor.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"unit-type": "lu",
3+
"label": "",
4+
"basedir": ".",
5+
"LaTeXinMD": true,
6+
"service-worker": "/path/to/service-worker.js",
7+
"units": [
8+
{
9+
"unit-type": "aim"
10+
},
11+
{
12+
"target": "theory.html",
13+
"source": "theory.md",
14+
"label": "Theory",
15+
"unit-type": "task",
16+
"content-type": "text"
17+
},
18+
{
19+
"target": "pretest.html",
20+
"source": "pretest.json",
21+
"label": "Pretest",
22+
"unit-type": "task",
23+
"content-type": "assesment"
24+
},
25+
{
26+
"target": "procedure.html",
27+
"source": "procedure.md",
28+
"label": "Procedure",
29+
"unit-type": "task",
30+
"content-type": "text"
31+
},
32+
{
33+
"target": "simulation.html",
34+
"source": "simulation/index.html",
35+
"label": "Simulation",
36+
"unit-type": "task",
37+
"content-type": "simulation"
38+
},
39+
{
40+
"target": "posttest.html",
41+
"source": "posttest.json",
42+
"label": "Posttest",
43+
"unit-type": "task",
44+
"content-type": "assesment"
45+
},
46+
{
47+
"target": "references.html",
48+
"source": "references.md",
49+
"label": "References",
50+
"unit-type": "task",
51+
"content-type": "text"
52+
}
53+
]
54+
}

experiment/.DS_Store

-6 KB
Binary file not shown.

experiment/README.md

Lines changed: 77 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,77 @@
1-
## README
2-
3-
## Quiz
4-
### 1. Introduction
5-
This part of the experiment is specifically for assessment purposes. This allows for the creation of a quiz with multiple choice single answer questions.
6-
These can be
7-
* Pretest - Pre requisite quizzes
8-
* Posttest - Testing the learning
9-
* Learning Unit Quizzes - Quizzes to test the section's learning.
10-
The format for the same is discussed below.
11-
12-
### 2. Target Audience
13-
This guide is meant for anyone creating a virtual lab and wanting to have a quiz section.
14-
15-
### 3. Structure of quiz
16-
The data for the quiz needs to be added to a json file pertaining the following specifications.
17-
1. The quiz needs to have an array of objects, each object representing a question. As shown below
18-
```
19-
"questions" : [
20-
{
21-
"question" : "What is 1+2 ?",
22-
"answers" :
23-
{
24-
"a" : 1,
25-
"b" : 2,
26-
"c" : 3,
27-
"d" : 4
28-
},
29-
"correctAnswer" : c
30-
}
31-
]
32-
```
33-
### 4. Quiz V2.0 (Enhancements done)
34-
The new format of quiz has multiple new additions. The details for which have been described below.
35-
The format of json would be as linked [here](./pretest.json)
36-
37-
First we will look at the additional fields added
38-
39-
### 4.1 Fields
40-
* Mandatory Fields
41-
* [version](#42-version) - Without which the enhanced quiz will not be rendered.
42-
* [levels](#44-levels) - Adds difficulty level to each question (Allows for filtering)
43-
44-
* Optional Fields
45-
* [explanations](#43-explanations) - Adds an explanation to each answer. If wrong answer is choosen, only it's explanation pops up. If correct answer is choosen, all available explanations pop up.
46-
47-
### 4.2 Version
48-
The very first field is absolutely necessary. This ensures that the quiz supports the new features.
49-
```
50-
"version": 2.0
51-
```
52-
53-
### 4.3 Explanations
54-
Just like we mention answers, we can have a section for explanation so that they show up after an answer is marked. This is optional and can completely be left out. The three ways of defining (Assuming there are 4 answers a, b, c, d):
55-
56-
1. All answers have explanations
57-
```
58-
"explanations": {
59-
"a" : "Explanation 1,
60-
"b" : "Explanation 2"
61-
"c" : "Explanation 3"
62-
"d" : "Explanation 4"
63-
},
64-
```
65-
2. Some answers have explanations
66-
```
67-
"explanations": {
68-
"a" : "Explanation 1,
69-
"d" : "Explanation 4"
70-
},
71-
```
72-
73-
3. No answers have explanations
74-
```
75-
/* Can be excluded from json */
76-
```
77-
78-
79-
### 4.4 Levels
80-
Adds an ability to filter questions based on difficulty levels. This is mandatory and has to be mentioned for each question.
81-
The three available difficulty levels are:
82-
```
83-
['beginner', 'intermediate', 'advanced']
84-
```
85-
Using any other will not work. The format for the same:
86-
```
87-
"difficulty" : "beginner"
88-
```
89-
90-
### 5. Tips
91-
1. An extra functionality of explanation is the ability to add an Rich Text (HTML Formatted). It will work just like in html.
92-
This could be used for
93-
a. Adding hyper links
94-
b. Formatting text etc.
95-
```
96-
"explanations": {
97-
"a" : "Explanation 1 <a href='www.google.com'>here</a>",
98-
"b" : "Explanation 2"
99-
},
100-
```
101-
> This can be done in either of explanation, answer and the question.
102-
An example for the same can be found here: source | website
103-
104-
2. Multi Correct
105-
To mimic the functionality of multi correct questions, one can add options as part of the question itself, and the actual answer options can be like :
106-
```
107-
"answers" :
108-
{
109-
"a" : "both i and ii",
110-
"b" : "All i, ii, iii, iv",
111-
"c" : "Only i",
112-
"d" : "None of the above"
113-
}
114-
```
115-
An example for the same can be found here: source | website
116-
117-
### 6. Manual Validation of Quiz Json (wrt version 2.0)
118-
This is till the automatic validation is set up.
119-
* The first field has to be version with 2 or 2.0 as value.
120-
* The questions needs to be an array of objects containing questions.
121-
* Each question object should hav a question field, answers field, difficulty field and correctAnswer field.
122-
* question : Should be a string
123-
* answer : Should be an object containing options, and each option should be a string.
124-
* difficulty : should be a string and should have values from ["beginner", "intermerdiate", "advanced"]
125-
* correctAnswer : Should be a string and it's value should be present in keys of one of the answer.
126-
* If explanation is present it has to be an object and needs to follow the description of answer object.
127-
128-
### 7. Test Cases
129-
- [x] Using the mentioned quiz format
130-
- [x] Using the old quiz json format
131-
- [ ] Not including the version in json
132-
- [ ] Including incorrect version in json
133-
- [ ] Including correct version but following old format
134-
- [x] Difficulty not mentioned
135-
- [x] Incorrect difficulty level mentioned
136-
- [x] explanation not provided for all options
137-
- [x] explanation empty
138-
- [x] explanation object not defined
139-
- [x] HTML in quuestion (tags like hyper links, bold etc)
140-
- [x] HTML in answer (tags like hyper links, bold etc)
141-
- [x] HTML in explanation (tags like hyper links, bold etc)
142-
- [x] On wrong annswer only wrong answer is colored red
143-
- [x] On correct answer all red color resets
144-
- [x] Combination of filters working properly
145-
- [x] If all questions have same difficulty, filter option should be hidden.
146-
- [x] When questions are answered after filtering, marks should be counted out of filtewred questions, not total.
147-
- [x] On wrong answer only explanation of wrong answer is shown
148-
- [x] On correct answer all available explanations are shown
149-
150-
### 8. TODO
151-
* Add automatic schema validation
152-
* Link to source files implementing the above tips.
1+
# Converting Regular Expression to NFA
2+
3+
## Overview
4+
This experiment demonstrates the conversion of regular expressions to Non-deterministic Finite Automata (NFA) using Thompson's construction algorithm. It provides an interactive visualization of the step-by-step process of building an NFA from a regular expression.
5+
6+
## Learning Objectives
7+
1. Understand the relationship between regular expressions and NFAs
8+
2. Learn Thompson's construction algorithm
9+
3. Visualize the step-by-step conversion process
10+
4. Test and validate the constructed NFA
11+
5. Understand the equivalence of regular expressions and NFAs
12+
13+
## Prerequisites
14+
- Basic understanding of regular expressions
15+
- Knowledge of finite automata concepts
16+
- Familiarity with basic set theory
17+
18+
## Experiment Structure
19+
The experiment consists of the following components:
20+
21+
1. **Input Section**
22+
- Regular expression input field
23+
- Example expressions
24+
- Start construction button
25+
26+
2. **Construction Visualization**
27+
- Step-by-step NFA construction
28+
- Interactive navigation controls
29+
- Auto-play feature
30+
- Progress tracking
31+
32+
3. **NFA Display**
33+
- Visual representation of states and transitions
34+
- Clear labeling of start and accept states
35+
- Epsilon transition visualization
36+
37+
4. **Testing Section**
38+
- String input for testing
39+
- Acceptance/rejection feedback
40+
- Multiple test cases
41+
42+
## How to Use
43+
1. Enter a regular expression or select an example
44+
2. Click "Start Construction" to begin
45+
3. Use navigation controls to step through the construction
46+
4. Observe how each operator affects the NFA
47+
5. Test the constructed NFA with various strings
48+
49+
## Features
50+
- Interactive step-by-step visualization
51+
- Support for all basic regular expression operators
52+
- Real-time NFA construction
53+
- String testing capability
54+
- Mobile-responsive design
55+
- Keyboard shortcuts for navigation
56+
57+
## Technical Details
58+
- Built with HTML5, CSS3, and JavaScript
59+
- Uses Canvas for NFA visualization
60+
- Implements Thompson's construction algorithm
61+
- Supports all standard regular expression operators
62+
63+
## Assessment
64+
The experiment includes:
65+
- Pre-test to assess prior knowledge
66+
- Post-test to evaluate learning
67+
- Interactive exercises
68+
- Practical assignments
69+
70+
## References
71+
See the references.md file for a complete list of academic sources and technical documentation.
72+
73+
## Contributors
74+
See the contributors.md file for information about the development team.
75+
76+
## License
77+
This experiment is part of the Virtual Labs project at IIIT Hyderabad and is available under the MIT License.

experiment/aim.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
### Aim of the experiment
1+
2+
To understand and implement Thompson's construction algorithm for converting regular expressions to Non-deterministic Finite Automata (NFA), and to demonstrate the equivalence between regular expressions and NFAs through interactive visualization.

experiment/contributors.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Contributors List
2+
3+
SrNo | Name | Faculty or Student | Department| Institute | Email id
4+
:--|:--|:--|:--|:--|:--|
5+
1 | Suryajith Chillara | Faculty | CSTAR | IIIT Hyderabad | suryajith.chillara@iiit.ac.in
6+
2 | Venkatesh Choppella | Faculty | SERC | IIIT Hyderabad | venkatesh.choppella@iiit.ac.in
7+
3 | Nithish Raja | Student | CSTAR | IIIT Hyderabad | nithish.raja@research.iiit.ac.in
8+

experiment/experiment-name.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
## Experiment name
1+
# Converting Regular Expression to NFA

experiment/images/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)