Documentation

This is a fast and clean look of what the library is, helping you to understand the whole library:

Information

This toolset follows PEG parser construction methodology, since it can be converted directly into recoverable recursive descent parser using preprcessor definition:

Examples

Amibiguous grammar

S ← 'x' S 'x' | 'x' 


For example, lets build parser for the non-LL(1), non-LR(1) grammar:

The code for the test method might looks like this:


        [TestMethod]
        public void TestMethod1()
        {
            Terminal x = 'x';
            Nonterminal S = "S";

            S.Definition = new Rules()
            {
                () => x + S + x,
                () => x
            };

            S.Initialize();
            S.Validate();

            Parser input = "xxx";

            bool actual = S.Parse(input);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }

Last edited Nov 22, 2010 at 11:38 PM by hack2root, version 12

Comments

No comments yet.