private static Compiled.Program GetProgram() { var externalPredicateDeclarations = new [] { Concat.GetConcat().Key, Lexer.GetExternalPredicateDeclaration() }; return(new Compiler().Compile("Morpher.txt", externalPredicateDeclarations)); }
private static Compiled.Program GetProgram(string fileName) { var externalPredicateDeclarations = new [] { Concat.GetConcat().Key, Lexer.GetExternalPredicateDeclaration() }; return(new Compiler().Compile(fileName, externalPredicateDeclarations)); }
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()); }
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)); }
public static IEnumerable <KeyValuePair <ExternalPredicateDeclaration, ExternalPredicateDefinition> > GetConcat() { return(new [] { Concat.GetConcat() }); }