Explain Regular Definition

  • A regular definition gives names to certain regular expressions and uses those names in other regular expressions
  • Here is a regular definition for the set of Pascal identifiers that is define as the set of strings of letters and digits beginning with a letters

            letter → A | B | . . . | Z | a | b | . . . | z

           digit → 0 | 1 | 2 | . . . | 9

            id → letter (letter | digit)*

  • The regular expression id is  the  pattern  for  the  identifier  token  and defines letter and digit. Where letter is a regular expression for the set of all upper-case and lower case letters in the alphabet and digit is the regular expression for the set of all decimal digits.

Leave a Reply