-
Notifications
You must be signed in to change notification settings - Fork 0
/
whatisaregularlanguage.html
73 lines (73 loc) · 4.03 KB
/
whatisaregularlanguage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>RIPAL: Responsive and Intuitive Parsing for the Analysis of Language</title>
<link href="styles/styles.css" rel="stylesheet" type="text/css" media="all"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
</head>
<body>
<h1>RIPAL: Responsive and Intuitive Parsing for the Analysis of Language</h1>
<h2>Pages</h2>
<nav aria-label="Pages">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="theory.html">Theory</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
<h2>What is a regular language?</h2>
<div class="section">
<h3>Background</h3>
<p>Finite languages are easy to understand, specify and recognize, but they're not very expressive.</p>
<p>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.</p>
</div>
<div class="section">
<h3>Language set operators</h3>
<p>To discuss regular languages, we need to first define the following set operators:</p>
<ol>
<li>If R<sub>1</sub> = {s<sub>1,1</sub>, s<sub>1,2</sub>, ...} and R<sub>2</sub> = {s<sub>2,1</sub>, s<sub>2,2</sub>, ...} then R = R<sub>1</sub>R<sub>2</sub> = {s<sub>1,1</sub>s<sub>2,1</sub>, s<sub>1,2</sub>s<sub>2,1</sub>, s<sub>1,1</sub>s<sub>2,2</sub>, ...}
<ol>
<li>Informally, the concatenation of two sets involves squishing together the a combination of one element from each set in the provided order of operands</li>
</ol>
</li>
<li>If R<sub>1</sub> = {s<sub>1,1</sub>, s<sub>1,2</sub>, ...} and R<sub>2</sub> = {s<sub>2,1</sub>, s<sub>2,2</sub>, ...} then R = R<sub>1</sub> ∪ R<sub>2</sub> = {s<sub>1,1</sub>, s<sub>2,1</sub>, s<sub>1,2</sub>, s<sub>2,2</sub>, ...}
<ol>
<li>Informally, the union of two sets involves including any element in either set</li>
</ol>
</li>
<li>If R<sub>1</sub> = {s<sub>1</sub>, s<sub>2</sub>, ...} then R = R<sub>1</sub><sup>*</sup> = {ε, s<sub>1</sub>, s<sub>2</sub>, s<sub>1</sub>s<sub>1</sub>, s<sub>1</sub>s<sub>2</sub>, s<sub>2</sub>s<sub>1</sub>, s<sub>2</sub>s<sub>2</sub>, s<sub>1</sub>s<sub>1</sub>s<sub>1</sub>, ...}
<ol>
<li>Informally, the Kleene closure of a set involves starting with ε and concatenating any element of that set any number of times</li>
</ol>
</li>
</ol>
</div>
<div class="section">
<h3>Definition</h3>
<div class="subsection definition">
<p><em>Definition</em></p>
<p>For any alphabet Σ:</p>
<ol>
<li>The empty language, L = {}, is regular</li>
<li>The language containing the empty string, L = {ε}, is regular</li>
<li>For any σ ∈ Σ, the language containing a fixed single-symbol string, L = {σ}, is regular</li>
<li>For any two regular languages R<sub>1</sub> and R<sub>2</sub>, the concatenation of those languages, L = R<sub>1</sub>R<sub>2</sub>, is regular</li>
<li>For any two regular languages R<sub>1</sub> and R<sub>2</sub>, the union of those languages, L = R<sub>1</sub> ∪ R<sub>2</sub>, is regular</li>
<li>For any regular language R<sub>1</sub>, the Kleene closure of that language, L = R<sub>1</sub><sup>*</sup>, is regular</li>
</ol>
</div>
</div>
<div class="section">
<h3>Regular language representations</h3>
<p>There are two straightfoward ways of specifying a regular language:</p>
<ul>
<li>A regular expression</li>
<li>A finite automaton</li>
</ul>
<p>These constructions will be explained in detail on subsequent pages.</p>
</div>
<hr/>
<p>GitHub Repository: <a href="https://github.com/bprollinson/ripal">https://github.com/bprollinson/ripal</a></p>
<p>Copyright © 2017 Brendan Rollinson-Lorimer</p>
</body>
</html>