예제 #1
0
        private static Compiled.Program GetProgram()
        {
            var externalPredicateDeclarations = new []
            {
                Concat.GetConcat().Key,
                Lexer.GetExternalPredicateDeclaration()
            };

            return(new Compiler().Compile("Morpher.txt", externalPredicateDeclarations));
        }
예제 #2
0
        private static Compiled.Program GetProgram(string fileName)
        {
            var externalPredicateDeclarations = new []
            {
                Concat.GetConcat().Key,
                Lexer.GetExternalPredicateDeclaration()
            };

            return(new Compiler().Compile(fileName, externalPredicateDeclarations));
        }
예제 #3
0
        private static void AssertSolutionCount(string text, int expectedSolutionCount)
        {
            var externalPredicates = new [] { Concat.GetConcat(), Lexer.GetLexer(new StringReader(text)) };

            program.SetExternalPredicateCallbacks(externalPredicates);

            var engine = new Engine();

            //var tracer = new Tracer();
            //engine.Unified += tracer.Engine_Unified;
            //engine.Failed  += tracer.Engine_Failed;

            var solutions = engine.Run(program).Select(Print).ToArray();

            Assert.AreEqual(expectedSolutionCount, solutions.Count());
        }
예제 #4
0
        static void Main(string [] args)
        {
            Compiled.Program program = GetProgram(args[0]);

            var externalPredicates = new [] { Concat.GetConcat(), Lexer.GetLexer(new StringReader("ордена ленина полк")) };

            program.SetExternalPredicateCallbacks(externalPredicates);

            var engine = new EngineInternals();

            var events = engine.Run(program);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1(events));
        }
예제 #5
0
 public static IEnumerable <KeyValuePair <ExternalPredicateDeclaration, ExternalPredicateDefinition> > GetConcat()
 {
     return(new [] { Concat.GetConcat() });
 }