Пример #1
0
        private static IFsm MakeNfa(Expr expr)
        {
            var fsm = ExprFsmBuilder.BuildFsm(expr, MakeNfa);

            fsm.SaveGraphToFile(@"c:\temp\outNFA.dgml");
            return(fsm);
        }
Пример #2
0
        private static IFsm MakeMDfa(Expr expr)
        {
            var fsm  = ExprFsmBuilder.BuildFsm(expr, MakeMDfa);
            var fsm2 = fsm.RemoveEmptyTransitions();
            var fsm3 = fsm2.MakeDFA();
            var fsm4 = fsm3.MinimizeDFA();

            return(fsm4);
        }
Пример #3
0
        private static IFsm MakeDfa(Expr expr)
        {
            var fsm  = ExprFsmBuilder.BuildFsm(expr, MakeDfa);
            var fsm2 = fsm.RemoveEmptyTransitions();
            var fsm3 = fsm2.MakeDFA();

            fsm3.SaveGraphToFile(@"c:\temp\outDFA.dgml");
            return(fsm3);
        }
Пример #4
0
        public static IFsm BuildFsm(Expr expr, Func <Expr, IFsm> checkerFsmBuilder)
        {
            var builder     = new ExprFsmBuilder(checkerFsmBuilder);
            var fsmFragment = expr.Apply(builder);
            var fsm         = builder._fsm;

            fsm.SetInitialState(fsmFragment.From);
            fsmFragment.To.SetFinal();

            return(fsm);
        }