コード例 #1
0
        static void Main(string[] args)
        {
            GrammarAction.Init();
            LexAction.Init();
            IntermediateGenerator.Init();

            var  pcre = new PcreRegex("asdf");
            var  m    = pcre.Match("as", PcreMatchOptions.PartialSoft);
            bool b    = m.IsPartialMatch;

            if (args.Length < 1)
            {
                do
                {
                    if (args.Length > 0)
                    {
                        if (!SubCommandInvoker.TryInvokeSubcommand(args))
                        {
                            Console.WriteLine($"Unkown Redmond command '{args[0]}'");
                        }
                    }
                    args = Console.ReadLine().Split(' ');
                } while (args[0] != "");
            }
            else
            {
                if (!SubCommandInvoker.TryInvokeSubcommand(args))
                {
                    Console.WriteLine($"Unkown Redmond command '{args[0]}'");
                }
            }
        }
コード例 #2
0
        public CompilationContext(ParseFile file, InputStream input, OutputStream output)
        {
            Input = new TokenStream(input, file.LexLines.ToBuilder().ToArray(), new string(Enumerable.Range('\x1', 127).Select(i => (char)i).ToArray()));

            ProductionEntry.Register = new ProductionEntryRegister();
            ProductionEntry.Register.ParseSerializedTags(file.TokenIdLines);

            Grammar   = new ParseGrammar(file);
            Generator = new IntermediateGenerator(output);
        }