Regular languages and regular expressions
There are two types of regular expressions.
We recall that a grammar G1 = (T, N, S, R) is a right regular expression if the rules of R are of the form: A → aB or A → a with A, B ∈ N and a ∈ T.
Recall that a grammar G2 = (T, N, S, R) is a left-hand regular expression if the rules of R are of the form: A → Ba or A → a with A, B ∈ N and a ∈ T .
The advantage of distinguishing regular grammars on the right or on the left appears during the analysis: if we read the symbols of the word to be analyzed from left to right, then
- a regular right-hand grammar will be used for a top-down analysis, from the axiom to the word
- a regular left-hand grammar will be used for a bottom-up analysis, from the word to the axiom.
For example, to analyze the word aaabb with the grammar G1, we will construct the derivation S1 ⇒ aS1 ⇒ aaS1 ⇒ aaaU1 ⇒ aaabU1 ⇒ aaabb; while to analyze this word with the G2 grammar, we will construct the derivation aaabb ⇐ U2aabb ⇐ U2abb ⇐ U2bb ⇐ S2b ⇐ S2.
Language and expression
The operators ∗,. and | have decreasing priority. If necessary, parentheses can be added.
The equivalence between regular expressions and regular languages is established by the following two implications:
- Any regular expression describes a regular language.
- Any regular language can be described by a regular expression.
Trivial equivalence list: