├── .eslintrc.json
├── .github
└── workflows
│ └── lint_and_test.yml
├── .gitignore
├── .vscode
└── settings.json
├── README.md
├── index.html
├── package-lock.json
├── package.json
├── pre-commit.sample
└── src
├── css
├── main.css
└── mdi.css
├── img
├── dfa-help.mp4
├── dfa-help.webm
├── e_key.png
├── favicon.png
├── logo.png
├── nfa-help.mp4
└── nfa-help.webm
└── js
├── canvas
├── draggable_canvas.js
├── drawables
│ ├── arrow.js
│ ├── arrowed_straight_line.js
│ ├── bezier_curved_line.js
│ ├── circle.js
│ ├── drawable.js
│ ├── quadratic_curved_line.js
│ ├── straight_line.js
│ └── text.js
├── location.js
└── renderer.js
├── elements
├── add_node_menu.js
├── edit_node_menu.js
├── edit_transition_menu.js
├── fsa_description.js
└── overlay_message.js
├── fsa
├── animated_nfa_converter.js
├── fsa.js
├── nfa_converter.js
└── visual_fsa.js
├── index.js
├── test
├── fsa.test.js
├── nfa_converter.test.js
└── visual_fsa.test.js
└── util
├── array.js
├── errors.js
├── event_handler.js
└── util.js
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "mocha": true
5 | },
6 | "extends": "standard",
7 | "parserOptions": {
8 | "ecmaVersion": 12,
9 | "sourceType": "module"
10 | },
11 | "rules": {
12 | "indent": [
13 | "error",
14 | 4
15 | ],
16 | "quote-props": [
17 | "error",
18 | "consistent"
19 | ]
20 | }
21 | }
--------------------------------------------------------------------------------
/.github/workflows/lint_and_test.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean install of dependencies and lint and test the project
2 |
3 | name: Lint and Test
4 |
5 | on:
6 | push:
7 | branches: [ master ]
8 | pull_request:
9 | branches: [ master ]
10 | workflow_dispatch:
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - uses: actions/setup-node@v3
20 | with:
21 | node-version: 14
22 | - name: Install dependencies
23 | run: npm install
24 | - name: Run linter
25 | run: npm run lint
26 | - name: Run tests
27 | run: npm test
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | requirements.txt
3 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint.format.enable": true,
3 | "editor.codeActionsOnSave": {
4 | "source.fixAll.eslint": true
5 | }
6 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Visual NFA to DFA Converter
2 | 
3 |
4 | https://joeylemon.github.io/nfa-to-dfa/
5 |
6 | ## Overview
7 |
8 |
9 |
10 | This tool is used to convert [non-deterministic finite automata](https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton) (NFA) to [deterministic finite automata](https://en.wikipedia.org/wiki/Deterministic_finite_automaton) (DFA) through an interactive and visual interface. More specifically, you can:
11 | - Create an NFA interactively or from a saved JSON file
12 | - Export an NFA to a JSON file
13 | - View the description of both the NFA and the DFA, including a full delta transition table
14 | - Convert the NFA to an equivalent DFA in three possible ways:
15 | - **Step-by-step**: the DFA is constructed in controlled increments
16 | - **All at once**: completely convert the NFA to the DFA in one leap
17 | - **Animated**: watch the conversion process take place automatically
18 |
19 | ### Technology
20 |
21 | 
22 |
23 | _Originally created by [Alex Klibisz](https://github.com/alexklibisz) and [Connor Minton](https://github.com/c-minton), COSC 312, Spring 2015, University of Tennessee, Knoxville._
24 |
25 | _Rewritten and enhanced by [Joey Lemon](https://github.com/joeylemon) and [Camille Williford](https://github.com/awillif), COSC 493, Fall 2021, University of Tennessee, Knoxville._
26 |
27 | ## Contributing
28 |
29 | ### Prerequisites
30 |
31 | You must have [Node.js v12.19.0+ and npm](https://nodejs.org/en/) installed to run the application locally. Node versions below v12.19.0 are unable to run the unit tests.
32 |
33 | ### Running Application
34 |
35 | To set up the application locally, first clone this repository:
36 | ```shell
37 | > git clone https://github.com/joeylemon/nfa-to-dfa.git
38 | ```
39 |
40 | Then, install the dependencies:
41 | ```shell
42 | > cd nfa-to-dfa
43 | > npm install
44 | ```
45 |
46 | Then, simply run the start script to create a local webserver:
47 | ```shell
48 | > npm start
49 | ```
50 |
51 | Running this script should give an output similar to below:
52 | ```shell
53 | > nfa-to-dfa@0.0.2 start ~/Desktop/nfa-to-dfa
54 | > browser-sync start -s -f . --no-notify --host localhost --port 8000
55 |
56 | [Browsersync] Access URLs:
57 | --------------------------------------
58 | Local: http://localhost:8000
59 | External: http://192.168.1.127:8000
60 | --------------------------------------
61 | UI: http://localhost:3001
62 | UI External: http://localhost:3001
63 | --------------------------------------
64 | [Browsersync] Serving files from: ./
65 | [Browsersync] Watching files...
66 | ```
67 |
68 | You can now navigate to `http://localhost:8000` in the browser to view the application. The website will automatically reload upon changes to the code.
69 |
70 | ### Linting
71 | Prior to adding changes to the repository, you should run the linter on the code to ensure there are no syntax errors and to maintain a uniform coding style:
72 | ```shell
73 | > npm run lint
74 | ```
75 |
76 | To automatically lint files before committing them, you should add a pre-commit hook. Copy the `pre-commit.sample` file to `.git/hooks/pre-commit`:
77 | ```shell
78 | > cp pre-commit.sample .git/hooks/pre-commit
79 | ```
80 |
81 | Now, git will automatically lint all changed files before committing them to the repository.
82 |
83 | ### Testing
84 | You should also test your changes before committing them to the repository:
85 | ```shell
86 | > npm test
87 | ```
88 |
89 | This will run all unit tests in the `src/js/test` directory and report any errors.
90 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
How to Build the NFA
65 | 66 |Start building the NFA by
When creating a transition between nodes, you will be prompted to press a key on your keyboard to
86 | represent the transition symbol. You can use any key, including uppercase values. However, to create
87 | an epsilon (ε) transition, you must press the key on your keyboard.
A video demonstration of the NFA creation process.
94 |How to Convert to a DFA
103 | 104 |After building the NFA, you can then start converting it to a DFA. This
107 | can be
108 | done in
A video demonstration of the DFA conversion process.
133 |210 | N = (Q, E, 𝛿, q0, F ) 211 |
212 |297 | M = (Q', E, 𝛿', q0', F' ) 298 |
299 |
329 | This application was created by
330 |