Hi,
I would like to know how I can implement a regular expression
for the following in C Language...
Assignment
For
Switch
Please provide me the answer it's urgent
Thanks in advance
Printable View
Hi,
I would like to know how I can implement a regular expression
for the following in C Language...
Assignment
For
Switch
Please provide me the answer it's urgent
Thanks in advance
Not easily. I tend to build up a parse tree for each character in a string.
I bet if you search this website as well as www.codeproject.com you'll find a few answers to your question.
I've implemented regular expression pattern matching before and basically I build up a list of elements with each character being either
(a) A character
(b) A control character (wildcard etc).
Then I use this to attempt to 'match' other strings to it.
Darwen.
If you want a ready made regular expression library, definetly checkout the regex class at http://www.boost.org.
Regular expressions should be used to tokenize your input. Your syntactical and semantical analyzers should determine if the input is valid. Thus you'll want to tokenize the language into its keywords, not into its statements.