RIPAL: Responsive and Intuitive Parsing for the Analysis of Language

Pages

What is a regular language?

Background

Finite languages are easy to understand, specify and recognize, but they're not very expressive.

In practice, many useful languages are not limited to a fixed number of strings. As a result, we need some way to begin to represent infinite languages.

Language set operators

To discuss regular languages, we need to first define the following set operators:

  1. If R1 = {s1,1, s1,2, ...} and R2 = {s2,1, s2,2, ...} then R = R1R2 = {s1,1s2,1, s1,2s2,1, s1,1s2,2, ...}
    1. Informally, the concatenation of two sets involves squishing together the a combination of one element from each set in the provided order of operands
  2. If R1 = {s1,1, s1,2, ...} and R2 = {s2,1, s2,2, ...} then R = R1 ∪ R2 = {s1,1, s2,1, s1,2, s2,2, ...}
    1. Informally, the union of two sets involves including any element in either set
  3. If R1 = {s1, s2, ...} then R = R1* = {ε, s1, s2, s1s1, s1s2, s2s1, s2s2, s1s1s1, ...}
    1. Informally, the Kleene closure of a set involves starting with ε and concatenating any element of that set any number of times

Definition

Definition

For any alphabet Σ:

  1. The empty language, L = {}, is regular
  2. The language containing the empty string, L = {ε}, is regular
  3. For any σ ∈ Σ, the language containing a fixed single-symbol string, L = {σ}, is regular
  4. For any two regular languages R1 and R2, the concatenation of those languages, L = R1R2, is regular
  5. For any two regular languages R1 and R2, the union of those languages, L = R1 ∪ R2, is regular
  6. For any regular language R1, the Kleene closure of that language, L = R1*, is regular

Regular language representations

There are two straightfoward ways of specifying a regular language:

These constructions will be explained in detail on subsequent pages.


GitHub Repository: https://github.com/bprollinson/ripal

Copyright © 2017 Brendan Rollinson-Lorimer