Regular Definition



If Σ represents the alphabet of basic symbols, then the regular definition denotes the set of definitions of the form

def1 → RE1

def2 → RE2

. . .

defn →REn

Where defi must be a new symbol not in Σ or any other defi and

REi is the regular expression over the alphabet Σ U{def1, def2,..defn}

Example:

Write the Regular Definition of an identifier in C language.

Explanation:

An identifier in C starts with  a character followed by zero or more instances of character or number.

Solution:

character →  a | b | . . | z | A | B | . . | Z | _

number   →  1 | 2 | . . | 9 | 0

identifier → character ( character | number )*

Simplified version

character →  [ a - z A - Z] |  _

number   →  [ 0 - 9 ]

identifier → character ( character | number )*