##// END OF EJS Templates
JSON moved to Formats namespace...
JSON moved to Formats namespace Working in RegularDFA

File last commit:

r162:0526412bbb26 ref20160224
r163:419aa51b04fd ref20160224
Show More
EDFADefinition.cs
29 lines | 880 B | text/x-csharp | CSharpLexer
using Implab;
using System;
namespace Implab.Parsing {
public class EDFADefinition<T> : DFADefinition where T : struct, IConvertible {
readonly EnumAlphabet<T> m_alphabet;
public EnumAlphabet<T> Alphabet {
get { return m_alphabet; }
}
public EDFADefinition(EnumAlphabet<T> alphabet) : base(alphabet.Count) {
m_alphabet = alphabet;
}
public void DefineTransition(int s1, int s2, T input) {
DefineTransition(s1, s2, m_alphabet.Translate(input));
}
public EDFADefinition<T> Optimize() {
return (EDFADefinition<T>)Optimize(alphabet => new EDFADefinition<T>((EnumAlphabet<T>)alphabet), m_alphabet, new EnumAlphabet<T>());
}
public void PrintDFA() {
PrintDFA(m_alphabet);
}
}
}