Regular expressions in specifications
. Regular expressions describe many useful languages
. Regular expressions are only specifications; implementation is still required
. Given a string s and a regular expression R,
does s ? L(R) ?
. Solution to this problem is the basis of the lexical analyzers
. However, just the yes/no answer is not important
. Goal: Partition the input into tokens
Regular expressions describe many useful languages. A regular expression is built out of simpler regular expressions using a set of defining rules. Each regular expression R denotes a regular language L(R). The defining rules specify how L(R) is formed by combining in various phases the languages denoted by the sub expressions of R. But regular expressions are only specifications, the implementation is still required. The problem before us is that given a string s and a regular expression R , we have to find whether s e L(R). Solution to this problem is the basis of the lexical analyzers. However, just determining whether s e L(R) is not enough. In fact, the goal is to partition the input into tokens. Apart from this we have to do bookkeeping and push back the extra characters.
|