Exemplo n.º 1
0
        /// <summary>
        /// Makes a simple lexer where each terminal is its own literal value.
        /// </summary>
        /// <returns>A lexer suitable for lexing the grammar</returns>
        public CharFA ToSimpleLexer()
        {
            var result = new CharFA();

            foreach (var t in _EnumTerminals())
            {
                if ("#ERROR" != t && "#EOS" != t)
                {
                    result.EpsilonTransitions.Add(CharFA.Literal(t, t));
                }
            }
            result = result.ToDfa();
            return(result);
        }