FormeleMethode/ThompsonConstruction.cs
/// <summary>
/// Converts regular expression to NDFA.
/// </summary>
/// <param name="regExpression">The reg expression.</param>
/// <returns></returns>
Converts regular expression to NDFA.
Converts regular expression to NDFA .
public static Automata<string> RegExpToNDFA(RegExpression regExpression)
		{
			Automata<string> ndfa = new Automata<string>();
			ndfa.DefineAsStartState("0");
			ndfa.DefineAsFinalState("1");
			int stateCounter = 2;
			Convert(regExpression, ref ndfa, ref stateCounter, 0, 1);
			ndfa.symbols = new SortedSet<char>(ndfa.transitions.Distinct().Select(e => e.GetSymbol()).ToList());
			ndfa.symbols.Remove('$');
			return ndfa;
		}
public static Automata < string > RegExpToNDFA ( RegExpression regExpression ) { Automata < string > ndfa = new Automata < string > ( ) ; ndfa . DefineAsStartState ( " " ) ; ndfa . DefineAsFinalState ( " " ) ; int stateCounter = 2 ; Convert ( regExpression , ref ndfa , ref stateCounter , 0 , 1 ) ; ndfa . symbols = new SortedSet < char > ( ndfa . transitions . Distinct ( ) . Select ( e => e . GetSymbol ( ) ) . ToList ( ) ) ; ndfa . symbols . Remove ( ' ' ) ; return ndfa ; }
Converts regular expression to NDFA.
Converts regular expression to NDFA .
// Remove epsilons
None
regExpression
RegExpression
The reg expression.
The reg expression .