Beispiel #1
0
        public void Titles()
        {
            var text = @"grammar Titles
            defs
            Expr : TextOrSubExpr*
            TextOrSubExpr : Text | SubExpr
            SubExpr : openCurly Text closeCurly
            patterns
            openCurly :'{'
            closeCurly : '}'
            colon : ':'
            Text : '^[a-zA-Z1-9_]+$'
            ";
            var utils = new Utils();

            Parsing.Core.GrammarDef.Parser parser = new Parsing.Core.GrammarDef.Parser();

            var root = parser.Parse(text);

            utils.NodeToString(root);

            var builder = new Builder();

            var grammar = builder.BuildGrammar(root);

            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\Lexer.cs", builder.BuildLexer(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\Parser.cs", builder.BuildParser2(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\NodeType.cs", builder.BuildNodeType(grammar));
            File.WriteAllText(@"C:\Temp\Parsing\V2.TitleBuilder\TokenType.cs", builder.BuildTokenType(grammar));

            builder.BuildLexer(grammar);
        }
Beispiel #2
0
        public Form1()
        {
            _utils = new Utils();
            _builder = new Builder();
            _parser = new Parser();
            _settings = new Settings();
            _settings.Load();

            InitializeComponent();

            LoadGrammerDefFile();
        }