- Fix can’t drag nodes after adding edges in TMEditor and NPDAEditor bug
- Edge label position update after adding edges
- In delete mode, when the label clicked has only one transition, the edge is deleted
- Click on label to delete in FAEditor
- getStackAlphabet and getTapeAlphabet functions moved to NPDA.js and TuringMachine.js
- Use ‘a,b;c’ form in NPDAEditor and ‘a;b,R’ form in TMEditor. The scenario here is to use ‘;’ to separate input and output
Today I added NPDAEditor, whose UI is very similar to TMEditor I completed several days ago. For edit/delete edges I did the similar thing with TMEditor, just that the third column is for the user to type instead of choosing from L, S or R. Then I fixed several things in both files: users can now put in □ and λ by leaving an entry blank when creating or editing an edge; alphabets are not updated when users load files from local directories. One problem to fix is the alphabet does not update when users delete nodes using the right-click menu. I didn’t check but this is probably a problem for FAEditor as well. I will fix this tomorrow.
For the next step I’m going to improve the UI for traversal displaying in NPDA and Turing Machine editors. There are also some label position issues with both editors.
- dragging boundary set for initial states. Initial markers now always appear
- one-click clear labels button added for FAEditor when coming back from minimization or conversion
- LaTex enabled in create exercise page. Instructors are able to type in LaTex such as m^n, which will appear as superscripts in exercises.
- edit and delete edges features added to TMEditor: in edit mode, clicking on a label will show a table containing transitions. Users can then change characters or delete transitions. Enter to confirm, Esc to cancel.
- move traversal functions to TuringMachine.js
- move save/load file functions to TuringMachine.js
- add delete node function
- add undo/redo and cancel buttons
- enable right click to edit nodes
- drag to add edges: after dragging a box appears at the middle of the dragged path, just like JFLAP
Demo of TMEditor:
- fix minimize DFA computational bug
- read about Turing Machines
- extend FA.js with TuringMachine.js
- minimize DFA
check for partition completeness fixed: the program no longer alerts the partition is not completed when it is.
variable minimizedEdges changed to 2D array with node(FAState) as parameters. minimizedEdges[i][j] is an array of characters on the edge from node i to node j
add trap states before everything so the program can run on incomplete DFAs
- Regular Expression
no unnecessary parentheses are added
right click menu no longer disables dragging
dragging no longer unhighlights nodes that are originally highlighted
notify the user about current action: toRE
regular expression now shows as the title of the page
Demo of FA – RE – NFA – DFA – minimize DFA:
- NFA -> DFA nodes layout bounds fixed
- FAtoRE dragging helper lines disappear after adding edges now
- in FAEditor clicking on ‘toRE’ will scroll up to jsav msg
- FATester, FAFixer scroll down for test results
- does not alert to export as soon as the user completes
- add check done button for NFAtoDFA
- add description feature to exercise generator
- make createDFAexercise prettier
Pretty create exercise page
Today I added a NFA to DFA tool. Before we had this file in exercise format, but now I created a new file with only the converting functions so that FAEditor can use it to convert NFA to DFA. Then I worked on the export of graphs between these files. Now you can start from FAEditor, create an FA, use the FAtoRE button to convert it to regular expression, and export to
REtoFA.html, from where you can convert back to NFA and export to
FAEditor, and further convert it to DFA and export back to
FAEditor, so it’s an ecosystem now, just like JFLAP. I will work on the minimizing proof tomorrow.
Today is the day I give up refactoring grammar. I changed the files back to its state and deleted the files I added. The functions and variables are hopeless. I don’t understand how one could continue adding code to this already relentless and magically working code. From next week I will focus on creating exercises models and exercises question generators instead of refactoring. I read some book chapters about refactoring methodologies and a paper about algorithm visualization softwares in the afternoon. The book is very useful and provided me some insights about refactoring. Sadly I’m not doing it again.
Today I did even more refactoring. I extracted methods from the long long code of parsing functions and moved the common ones to a file
ParseHelper.js. The file contains a ParseHelper class, whose objects are able to hold many grammar-related variables. This will make my life much easier. Functions that do not need so many variables or are not only relavent to parsing are moved to
GrammarTools.js. Other than this, I also moved each parsing function to its own controller file. The controllers also act as classes. Object oriented af!
Oh yes, before all these I moved the exercise feature to
ExerciseController.js. FATester and FAFixer are now configured to use this class.