kvrigor / dfa2cfg Goto Github PK
View Code? Open in Web Editor NEWNaive GUI app for generating the context-free grammar (CFG) from an input deterministic finite automaton (DFA).
License: GNU General Public License v3.0
Naive GUI app for generating the context-free grammar (CFG) from an input deterministic finite automaton (DFA).
License: GNU General Public License v3.0
Unable to AddState on a newly initialized DFA.
'_states is NULL at _states.Contains
Public Overridable Sub AddStates(ByVal s As String)
If _states.Contains(s) Then
Throw New ArgumentException($"The set of states already contains '{s}'.")
Else
_states.Add(s)
End If
End Sub
'My sample code in C#
myDFA = new Codecs.Languages.Regular.DFA();
myDFA.InputSymbols = new string[2] { "1", "2" };
myDFA.AddStates(State.StateCollection.Keys.ToArray());
foreach (KeyValuePair<string,State> item in State.StateCollection)
{
StatesViewer.Rows.Add(item.Key, item.Value.m_TargetOne.Name, item.Value.m_TargetZero.Name);
Codecs.Languages.Regular.TransFunc trans1 = new Codecs.Languages.Regular.TransFunc();
trans1.PrevState = item.Key;
trans1.Input = "1";
trans1.NextState = item.Value.m_TargetOne.Name;
myDFA.AddTransitions(trans1);
Codecs.Languages.Regular.TransFunc trans0 = new Codecs.Languages.Regular.TransFunc();
trans0.PrevState = item.Key;
trans0.Input = "0";
trans0.NextState = item.Value.m_TargetZero.Name;
myDFA.AddTransitions(trans0);
if (item.Value.IsAccept)
myDFA.AddFinalStates(item.Key);
}
Codecs.Languages.ContextFree.CFG sa = Codecs.Utils.DFAExtensions.ToCFG(myDFA, "CFG1");
richTextBox1.Text = myDFA.ToString();
richTextBox2.Text = sa.ToString();
To determine if an instance of a DFA object is valid, these properties need to be checked:
Check ConsolApp.vb for sample usage
To better isolate different features of our software, how about adding a reference to Codecs.dll instead of including its project source code to your solution? With this you'll need to build the binaries first from Codecs.vbproj.
Provide code to the method below found on DFA.vb:
Protected Function PrintTransitionTable() As String
'TODO: Display transition functions in tabular format
Return ""
End Function
Will be useful in pretty-printing the DFA 5-tuple definition!
To determine if an instance of a CFG object is valid, these properties need to be checked:
Have I missed anything?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.