Click here to Skip to main content
15,893,904 members
Articles / Programming Languages / C#

An Implementation of Regular Expression Parser in C#

Rate me:
Please Sign up or sign in to vote.
4.91/5 (43 votes)
24 Jun 2009CPOL8 min read 186.4K   7.2K   116  
An article on how one can implement regular expression parser
using System;
using System.Collections.Generic;
using System.Text;

namespace RegularExpression
{
  /// <summary>
  /// see NfaDiagram.txt file.
  /// this class represent a box in that diagram.
  /// this class helps constructing the NFA from the regular expression
  /// </summary>
  class NfaExpression
  {
    public NfaExpression()
    {
      m_stateStart = new State();
      m_stateFinal = new State();

    }
    public NfaExpression(State stateFrom, State stateTo)
    {
      m_stateStart = stateFrom;
      m_stateFinal = stateTo;

    }

    State m_stateStart = null;
    State m_stateFinal = null;

    public State StartState()
    {
      return m_stateStart;
    }

    public State FinalState()
    {
      return m_stateFinal;
    }


  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Denmark Denmark
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions