Example #1
0
 public static void Build(GrammarTables result, Grammar grammar)
 {
     using (var builder = new BuildDFA())
     {
         builder.InternalBuild(result, grammar);
     }
 }
Example #2
0
        public override Automata CreateAutomata(BuildDFA buildDfa)
        {
            int head = buildDfa.AddState();
            int tail = buildDfa.AddState();

            foreach (Sequence sequence in m_expression)
            {
                Automata type = sequence.CreateAutomata(buildDfa);
                buildDfa.AddLambdaEdge(head, type.Head);
                buildDfa.AddLambdaEdge(type.Tail, tail);
            }

            HandleKleen(buildDfa, head, tail);

            return(new Automata
            {
                Head = head,
                Tail = tail
            });
        }