Regular Expressions for Identifiers
The lexical Analyzer has to only identify a finite set of valid strings or tokens or lexemes. It finds the pattern given by the language rules.
Regular expressions can express finite languages by giving a pattern for the finite strings of symbols.
- The grammar defined by regular expressions is known as regular grammar.
- The language defined by regular grammar is known as regular language.
Regular expressions are used to match a pattern to a set of strings.
There are different algebraic laws that are followed by regular expressions. These are used to manipulate regular expressions into equivalent forms.
Operations:
The different operations that can be performed are:
- Union: Two languages can be form a union as
L U M = {s | s is in L or s is in M}
- Concatenation: Two languages can be concatenated as
LM = {st | s is in L and t is in M}
- Closure: The closure of a language can be written as
L* = Occurrence of language L more than once.
Reference Link
