Regular expressions are used to represent the language of finite automata. This package takes a regular expression and transforms it into a deterministic finite automata (DFA)
Regular expression can be converted into DFA by the following methods:
(i) Thompson’s subset construction
• Given regular expression is converted into NFA
• Resultant NFA is converted into DFA
(ii) Direct Method
• In direct method, given regular expression is converted directly into DFA.
Rules for Conversion of Regular Expression to NFA
• Union
r = r1 + r2
Convert Regular Expression to DFA - Compiler Design
Concatenation
r = r1 r2
Convert Regular Expression to DFA - Compiler Design
Closure
r = r1*
Convert Regular Expression to DFA - Compiler Design
Ɛ –closure Ɛ - Closure is the set of states that are reachable from the state concerned on taking empty string as input. It describes the path that consumes empty string (Ɛ) to reach some states of NFA.
NFA state transitions are determined by the current state and partial use of the input information. In many future cases there may be the same entry and the same situation. The machine may pass any of these situations.
This application is a java application and includes 11 java classes - 1 java form
Converter.java - the class which converting
Helper.java - Auxiliary functions
Main.java - display showing converting operations form
Relation.java - class holding associations between Nfa states
State.java - Class in which user-entered Nfa states are kept
State_Relation.java - class holding associations between Nfa states
State_Relation_Dfa.java - class holding associations between Dfa states
StateDfa.java - Class in which created Dfa states are kept
StateDfaList.java - List of Dfa states created by the program
StateList.java - List of Nfa states entered by users
StateNfa.java - Class in which created Nfa states are kept
And my program working with this screen:
Reference for NFA steps’ pictures http://ecomputernotes.com/compiler-design/convert-regular-expression-to-dfa
This web page and program prepared by Dila Erbakan