2020CS409 Lab Manual
2020CS409 Lab Manual
(Lab Manual)
Submitted by
2020CS409 Faizan Abbas
pg. 1
Table of Contents
Labs Pg. #
Lab # 01 03
Lab # 02 06
Lab # 03 14
Semester Assignment 1 18
Lab # 07 52
Lab # 09 57
Lab # 11 71
Semester Assignment 2 74
pg. 2
Lab # 01
pg. 3
pg. 4
pg. 5
pg. 6
Lab # 02
pg. 7
pg. 8
pg. 9
pg. 10
Code:
#include <iostream>
#include <string>
void firstFunc() {
string userInput;
cin.ignore();
getline(cin, userInput);
if (userInput == "aaaabbabbaaaaabababaabba") {
else {
void secondFunc() {
string userInput;
cin.ignore();
getline(cin, userInput);
if (userInput == "abbbbbaaabbabaaaaaaabaabaabaa") {
else {
pg. 11
void thirdFunc() {
string userInput;
cin.ignore();
getline(cin, userInput);
if (userInput == "baaababbaaabaaaaaaabaabaabaa") {
else {
void forthFunc() {
string userInput;
cin.ignore();
getline(cin, userInput);
if (userInput == "baaaabbababbbabbababaa") {
else {
void fifthFunc() {
string userInput;
cin.ignore();
getline(cin, userInput);
pg. 12
if (userInput == "bababbaaababbaabbbbabbababaa") {
else {
int main() {
int choice;
do {
switch (choice)
case 1:
firstFunc();
break;
case 2:
secondFunc();
break;
case 3:
thirdFunc();
break;
case 4:
pg. 13
forthFunc();
break;
case 5:
fifthFunc();
break;
default:
break;
return 0;
pg. 14
Lab # 03
Program # 1:
#include <iostream>
#include <string>
using namespace std;
bool isValidInput(const string& value) {
// '^' represents lambda
if (value == "^") {
return true;
}
for (char ch : value) {
if (ch != 'a' && ch != 'b') {
return false;
}
}
return true;
}
int main() {
string userInput;
cout << "Enter an input (a+b)*: ";
cin >> userInput;
bool onlyAandB = isValidInput(userInput);
if (onlyAandB) {
cout << "Valid Input" << endl;
} else {
cout << "Invalid Input" << endl;
}
return 0;
}
pg. 15
Program # 2:
#include <iostream>
#include <string>
using namespace std;
void checkStringConditions(const std::string& value) {
// Check if the string contains only 0s and 1s
bool validString = true;
for (char ch : value) {
if (ch != '0' && ch != '1') {
validString = false;
break;
}
}
if (!validString) {
std::cout << "Invalid Input.\n";
return;
}
// Check for each case using range-based for loops
for (char ch : value) {
if (ch == '1') {
std::cout << "(1-2)\n";
break;
}
}
for (char ch : value) {
if (ch == '0') {
cout << "(1-3)\n";
break;
}
}
pg. 16
for (int i = 0; i < value.length() - 1; i++) {
if (value[i] == '0' && value[i + 1] == '1') {
cout << "(1-4)\n";
break;
}
}
if (value.back() == '0') {
cout << "(1-5)\n";
}
if (value.back() == '1') {
cout << "(2-3)\n";
}
for (int i = 0; i < value.length() - 1; i++) {
if (value[i] == '0' && value[i + 1] == '0') {
cout << "(2-4)\n";
break;
}
}
for (int i = 0; i < value.length() - 1; i++) {
if (value[i] == '1' && value[i + 1] == '1') {
cout << "(2-5)\n";
break;
}
}
if (value.front() == '0' && value.back() == '1') {
cout << "(3-4)\n";
}
if (value.front() == '1' && value.back() == '0') {
cout << "(3-5)\n";
}
pg. 17
for (int i = 0; i < value.length() - 1; i++) {
if (value[i] == '1' && value[i + 1] == '0') {
cout << "(4-5)\n";
break;
}
}
}
int main() {
string userInput;
// Get input from the user
cout << "Enter a string: ";
cin >> userInput;
checkStringConditions(userInput);
return 0;
}
pg. 18
Lab # 05 [Assignment # 1 Semester Project]
pg. 19
Sigma Infusion
Token Recognition
1) Token: #id.
Trace: {a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
2) Token: nameui.
Trace: {a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
3) Token: imain.
Trace: {a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
4) Token: strbri
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
pg. 20
DFSA:
5) Token: endbri
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
6) Token: print
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
7) Token: semi
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
8) Token: strin
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
9) Token: endin
pg. 21
RE: (a+b)*. b*(a+b)*. a*(a+b)*. a*b*.b*(a+b)*
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, ba, bb, aaa, abb, aba, aab, baa, bab, bba, bbb,…}
DFSA:
12) Token: i
RE: a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 22
14) Token: dli
RE: a*(a+b)*.b*a*(a+b)*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
RE: a*(a+b)*a*b*.(a+b)*a*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 23
19) Token: in
RE: a*b*.b*(a+b)*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
22) Token: fi
RE: (a+b)*b*a*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 24
RE: a*b*. b*a*(a+b)*. a*b* (a+b)*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 25
28) Token: brsemi
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 26
33) Token: pic
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 27
RE: a*b*.b*(a+b)*b*.(a+b)*. (a+b)*b*a*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 28
42) Token: sfi
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 29
RE: (a+b)*.a*b*.(a+b)*. a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
RE: b*(a+b)*.(a+b)*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
RE: b*a*(a+b)*.(a+b)*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
RE: a*b*a*(a+b)*.(a+b)*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
RE: b*b*(a+b)*.(a+b)*.a*b*
Trace: {λ, a, b, ab, aa, bb, aab, abb, aaa, bbb, aab, abb, aaaa, aaab, aabb, abbb, bbbb,…}
DFSA:
pg. 30
Control Language
pg. 31
Combination R.E. Combination R.E. Combination R.E.
(0+1)*00110
1-32 (0+1)*1111 2-29 3-27 (0+1)*11011
0
(0+1)*00110
1-33 (0+1)*00000 2-30 3-28 (0+1)*11100
1
(0+1)*00111
1-34 (0+1)*00001 2-31 3-29 (0+1)*11101
0
(0+1)*00111
1-35 (0+1)*00010 2-32 3-30 (0+1)*11110
1
1-36 (0+1)*00011 2-33 (0+1)*01110 3-31 (0+1)*11111
1-37 (0+1)*00100 2-34 (0+1)*01111 3-32 (0+1)*000000
1-38 (0+1)*00101 2-35 (0+1)*10000 3-33 (0+1)*000001
1-39 (0+1)*00110 2-36 (0+1)*10001 3-34 (0+1)*000010
1-40 (0+1)*00111 2-37 (0+1)*10010 3-35 (0+1)*000011
1-41 (0+1)*01000 2-38 (0+1)*10011 3-36 (0+1)*000100
1-42 (0+1)*01001 2-39 (0+1)*10100 3-37 (0+1)*000101
1-43 (0+1)*01010 2-40 (0+1)*10101 3-38 (0+1)*000110
1-44 (0+1)*01011 2-41 (0+1)*10110 3-39 (0+1)*000111
1-45 (0+1)*01100 2-42 (0+1)*10111 3-40 (0+1)*001000
1-46 (0+1)*01101 2-43 (0+1)*11000 3-41 (0+1)*001001
(0+1)*10000
3-42 (0+1)*001010 4-41 5-41 (0+1)*110000
0
(0+1)*10000
3-43 (0+1)*001011 4-42 5-42s (0+1)*110001
1
(0+1)*10001
3-44 (0+1)*001100 4-43 5-43 (0+1)*110010
0
(0+1)*10001
3-45 (0+1)*001101 4-44 5-44 (0+1)*110011
1
(0+1)*10010
3-46 (0+1)*001110 4-45 5-45 (0+1)*110100
0
(0+1)*10010
3-47 (0+1)*001111 4-46 5-46 (0+1)*110101
1
(0+1)*10011
3-48 (0+1)*010000 4-47 5-47 (0+1)*110110
0
(0+1)*10011
3-49 (0+1)*010001 4-48 5-48 (0+1)*110111
1
(0+1)*10100
3-50 (0+1)*010010 4-49 5-49 (0+1)*111000
0
(0+1)*10100
4-5 (0+1)*010011 4-50 5-50 (0+1)*111001
1
(0+1)*10101
4-6 (0+1)*010100 5-6 6-7 (0+1)*111010
0
(0+1)*10101
4-7 (0+1)*010101 5-7 6-8 (0+1)*111011
1
(0+1)*10110
4-8 (0+1)*010110 5-8 6-9 (0+1)*111100
0
pg. 32
Combination R.E. Combination R.E. Combination R.E.
(0+1)*10110
4-9 (0+1)*010111 5-9 6-10 (0+1)*111101
1
(0+1)*10111
4-10 (0+1)*011000 5-10 6-11 (0+1)*111110
0
(0+1)*10111
4-11 (0+1)*011001 5-11 6-12 (0+1)*111111
1
(0+1)*11000
4-12 (0+1)*011010 5-12 6-13 (0+1)*0000000
0
(0+1)*11000
4-13 (0+1)*011011 5-13 6-14 (0+1)*0000001
1
(0+1)*11001
4-14 (0+1)*011100 5-14 6-15 (0+1)*0000010
0
(0+1)*11001
4-15 (0+1)*011101 5-15 6-16 (0+1)*0000011
1
(0+1)*11010
4-16 (0+1)*011110 5-16 6-17 (0+1)*0000100
0
(0+1)*11010
4-17 (0+1)*011111 5-17 6-18 (0+1)*0000101
1
(0+1)*11011
4-18 (0+1)*100000 5-18 6-19 (0+1)*0000110
0
(0+1)*11011
4-19 (0+1)*001010 5-19 6-20 (0+1)*0000111
1
(0+1)*11100
4-20 (0+1)*001011 5-20 6-21 (0+1)*0001000
0
(0+1)*11100
4-21 (0+1)*001100 5-21 6-22 (0+1)*0001001
1
(0+1)*11101
4-22 (0+1)*001101 5-22 6-23 (0+1)*0001010
0
(0+1)*11101
4-23 (0+1)*001110 5-23 6-24 (0+1)*0001011
1
(0+1)*11110
4-24 (0+1)*001111 5-24 6-25 (0+1)*0001100
0
(0+1)*10000
4-25 (0+1)*010000 5-25 6-26 (0+1)*110000
0
(0+1)*10000
4-26 (0+1)*010001 5-26 6-27 (0+1)*110001
1
(0+1)*10001
4-27 (0+1)*010010 5-27 6-28 (0+1)*110010
0
(0+1)*10001
4-28 (0+1)*010011 5-28 6-29 (0+1)*110011
1
(0+1)*10010
4-29 (0+1)*010100 5-29 6-30 (0+1)*110100
0
(0+1)*10010
4-30 (0+1)*010101 5-30 6-31 (0+1)*110101
1
(0+1)*10011
4-31 (0+1)*010110 5-31 6-32 (0+1)*110110
0
pg. 33
Combination R.E. Combination R.E. Combination R.E.
(0+1)*10011
4-32 (0+1)*010111 5-32 6-33 (0+1)*110111
1
(0+1)*10100
4-33 (0+1)*011000 5-33 6-34 (0+1)*111000
0
(0+1)*10100
4-34 (0+1)*011001 5-34 6-35 (0+1)*111001
1
(0+1)*10101
4-35 (0+1)*011010 5-35 6-36 (0+1)*111010
0
(0+1)*10101
4-36 (0+1)*011011 5-36 6-37 (0+1)*111011
1
(0+1)*10110
4-37 (0+1)*011100 5-37 6-38 (0+1)*111100
0
(0+1)*10110
4-38 (0+1)*011101 5-38 6-39 (0+1)*111101
1
(0+1)*10111
4-39 (0+1)*011110 5-39 6-40 (0+1)*111110
0
(0+1)*10111
4-40 (0+1)*011111 5-40 6-41 (0+1)*111111
1
(0+1)*00100
6-42 (0+1)*0000000 7-44 8-47 (0+1)*0100110
11
(0+1)*00101
6-43 (0+1)*0000001 7-45 8-48 (0+1)*0100111
00
(0+1)*00101
6-44 (0+1)*0000010 7-46 8-49 (0+1)*0101000
01
(0+1)*00101
6-45 (0+1)*0000011 7-47 8-50 (0+1)*0101001
10
(0+1)*00101
6-46 (0+1)*0000100 7-48 9-10 (0+1)*0101010
11
(0+1)*00110
6-47 (0+1)*0000101 7-49 9-11 (0+1)*0101011
00
(0+1)*00110
6-48 (0+1)*0000110 7-50 9-12 (0+1)*0101100
01
(0+1)*00110
6-49 (0+1)*0000111 8-9 9-13 (0+1)*0101101
10
(0+1)*00110
6-50 (0+1)*0001000 8-10 9-14 (0+1)*0101110
11
(0+1)*00111
7-8 (0+1)*0001001 8-11 9-15 (0+1)*0101111
00
(0+1)*00111
7-9 (0+1)*0001010 8-12 9-16 (0+1)*0110000
01
(0+1)*00111
7-10 (0+1)*0001011 8-13 9-17 (0+1)*0110001
10
(0+1)*00111
7-11 (0+1)*0001100 8-14 9-18 (0+1)*0110010
11
(0+1)*01000
7-12 (0+1)*0001101 8-15 9-19 (0+1)*0110011
00
pg. 34
Combination R.E. Combination R.E. Combination R.E.
(0+1)*01000
7-13 (0+1)*0001110 8-16 9-20 (0+1)*0110100
01
(0+1)*01000
7-14 (0+1)*0001111 8-17 9-21 (0+1)*0110101
10
(0+1)*01000
7-15 (0+1)*0010000 8-18 9-22 (0+1)*0110110
11
(0+1)*01001
7-16 (0+1)*0010001 8-19 9-23 (0+1)*0110111
00
(0+1)*01001
7-17 (0+1)*0010010 8-20 9-24 (0+1)*0111000
01
(0+1)*01001
7-18 (0+1)*0010011 8-21 9-25 (0+1)*0111001
10
(0+1)*01001
7-19 (0+1)*0010100 8-22 9-26 (0+1)*0111010
11
(0+1)*01010
7-20 (0+1)*0010101 8-23 9-27 (0+1)*0111011
00
(0+1)*01010
7-21 (0+1)*0010110 8-24 9-28 (0+1)*0111100
01
(0+1)*01010
7-22 (0+1)*0010111 8-25 9-29 (0+1)*0100110
10
(0+1)*01010
7-23 (0+1)*0011000 8-26 9-30 (0+1)*0100111
11
(0+1)*01011
7-24 (0+1)*0011001 8-27 9-31 (0+1)*0101000
00
(0+1)*00100
7-25 (0+1)*0000000 8-28 9-32 (0+1)*0101001
11
(0+1)*00101
7-26 (0+1)*0000001 8-29 9-33 (0+1)*0101010
00
(0+1)*00101
7-27 (0+1)*0000010 8-30 9-34 (0+1)*0101011
01
(0+1)*00101
7-28 (0+1)*0000011 8-31 9-35 (0+1)*0101100
10
(0+1)*00101
7-29 (0+1)*0000100 8-32 9-36 (0+1)*0101101
11
(0+1)*00110
7-30 (0+1)*0000101 8-33 9-37 (0+1)*0101110
00
(0+1)*00110
7-31 (0+1)*0000110 8-34 9-38 (0+1)*0101111
01
(0+1)*00110
7-32 (0+1)*0000111 8-35 9-39 (0+1)*0110000
10
(0+1)*00110
7-33 (0+1)*0001000 8-36 9-40 (0+1)*0110001
11
(0+1)*00111
7-34 (0+1)*0001001 8-37 9-41 (0+1)*0110010
00
(0+1)*00111
7-35 (0+1)*0001010 8-38 9-42 (0+1)*0110011
01
pg. 35
Combination R.E. Combination R.E. Combination R.E.
(0+1)*00111
7-36 (0+1)*0001011 8-39 9-43 (0+1)*0110100
10
(0+1)*00111
7-37 (0+1)*0001100 8-40 9-44 (0+1)*0110101
11
(0+1)*01000
7-38 (0+1)*0001101 8-41 9-45 (0+1)*0110110
00
(0+1)*01000
7-39 (0+1)*0001110 8-42 9-46 (0+1)*0110111
01
(0+1)*01000
7-40 (0+1)*0001111 8-43 9-47 (0+1)*0111000
10
(0+1)*01000
7-41 (0+1)*0010000 8-44 9-48 (0+1)*0111001
11
(0+1)*01001
7-42 (0+1)*0010001 8-45 9-49 (0+1)*0111010
00
(0+1)*01001
7-43 (0+1)*0010010 8-46 9-50 (0+1)*0111011
01
(0+1)*10011
10-11 (0+1)*0111100 11-17 12-24 (0+1)*1100011
11
(0+1)*10100
10-12 (0+1)*0111101 11-18 12-25 (0+1)*1100100
00
(0+1)*10100
10-13 (0+1)*0111110 11-19 12-26 (0+1)*1100101
01
(0+1)*10100
10-14 (0+1)*0111111 11-20 12-27 (0+1)*1100110
10
(0+1)*10100
10-15 (0+1)*1000000 11-21 12-28 (0+1)*1100111
11
(0+1)*10101
10-16 (0+1)*1000001 11-22 12-29 (0+1)*1101000
00
(0+1)*10101
10-17 (0+1)*1000010 11-23 12-30 (0+1)*1101001
01
(0+1)*10101
10-18 (0+1)*1000011 11-24 12-31 (0+1)*1101010
10
(0+1)*10101
10-19 (0+1)*1000100 11-25 12-32 (0+1)*1101011
11
(0+1)*10110
10-20 (0+1)*1000101 11-26 12-33 (0+1)*1101100
00
(0+1)*10110
10-21 (0+1)*1000110 11-27 12-34 (0+1)*1101101
01
(0+1)*10110
10-22 (0+1)*1000111 11-28 12-35 (0+1)*1101110
10
(0+1)*10110
10-23 (0+1)*1001000 11-29 12-36 (0+1)*1101111
11
(0+1)*10111
10-24 (0+1)*1001001 11-30 12-37 (0+1)*1110000
00
(0+1)*10111
10-25 (0+1)*1001010 11-31 12-38 (0+1)*1110001
01
pg. 36
Combination R.E. Combination R.E. Combination R.E.
(0+1)*10111
10-26 (0+1)*1001011 11-32 12-39 (0+1)*1110010
10
(0+1)*10111
10-27 (0+1)*1001100 11-33 12-40 (0+1)*1110011
11
(0+1)*11000
10-28 (0+1)*1001101 11-34 12-41 (0+1)*1110100
00
(0+1)*11000
10-29 (0+1)*1001110 11-35 12-42 (0+1)*1110101
01
(0+1)*11000
10-30 (0+1)*1001111 11-36 12-43 (0+1)*1110110
10
(0+1)*11000
10-31 (0+1)*1010000 11-37 12-44 (0+1)*1110111
11
(0+1)*11001
10-32 (0+1)*1010001 11-38 12-45 (0+1)*1100011
00
(0+1)*11001
10-33 (0+1)*1010010 11-39 12-46 (0+1)*1100100
01
(0+1)*11001
10-34 (0+1)*1010011 11-40 12-47 (0+1)*1100101
10
(0+1)*11001
10-35 (0+1)*1010100 11-41 12-48 (0+1)*1100110
11
(0+1)*10011
10-36 (0+1)*1010101 11-42 12-49 (0+1)*1100111
11
(0+1)*10100
10-37 (0+1)*0111100 11-43 12-50 (0+1)*1101000
00
(0+1)*10100
10-38 (0+1)*0111101 11-44 13-14 (0+1)*1101001
01
(0+1)*10100
10-39 (0+1)*0111110 11-45 13-15 (0+1)*1101010
10
(0+1)*10100
10-40 (0+1)*0111111 11-46 13-16 (0+1)*1101011
11
(0+1)*10101
10-41 (0+1)*1000000 11-47 13-17 (0+1)*1101100
00
(0+1)*10101
10-42 (0+1)*1000001 11-48 13-18 (0+1)*1101101
01
(0+1)*10101
10-43 (0+1)*1000010 11-49 13-19 (0+1)*1101110
10
(0+1)*10101
10-44 (0+1)*1000011 11-50 13-20 (0+1)*1101111
11
(0+1)*10110
10-45 (0+1)*1000100 12-13 13-21 (0+1)*1110000
00
(0+1)*10110
10-46 (0+1)*1000101 12-14 13-22 (0+1)*1110001
01
(0+1)*10110
10-47 (0+1)*1000110 12-15 13-23 (0+1)*1110010
10
(0+1)*10110
10-48 (0+1)*1000111 12-16 13-24 (0+1)*1110011
11
pg. 37
Combination R.E. Combination R.E. Combination R.E.
(0+1)*10111
10-49 (0+1)*1001000 12-17 13-25 (0+1)*1110100
00
(0+1)*10111
10-50 (0+1)*1001001 12-18 13-26 (0+1)*1110101
01
(0+1)*10111
11-12 (0+1)*1001010 12-19 13-27 (0+1)*1110110
10
(0+1)*10111
11-13 (0+1)*1001011 12-20 13-28 (0+1)*1110111
11
(0+1)*11000
11-14 (0+1)*1001100 12-21 13-29 (0+1)*1100011
00
(0+1)*11000
11-15 (0+1)*1001101 12-22 13-30 (0+1)*1100100
01
(0+1)*11000
11-16 (0+1)*1001110 12-23 13-31 (0+1)*1100101
10
(0+1)*11010
13-32 (0+1)*1100110 14-41 16-17 (0+1)*1101110
11
(0+1)*11011
13-33 (0+1)*1100111 14-42 16-18 (0+1)*1101111
00
(0+1)*11011
13-34 (0+1)*1101000 14-43 16-19 (0+1)*1110000
01
(0+1)*11011
13-35 (0+1)*1101001 14-44 16-20 (0+1)*1110001
10
(0+1)*11011
13-36 (0+1)*1101010 14-45 16-21 (0+1)*1110010
11
(0+1)*11100
13-37 (0+1)*1101011 14-46 16-22 (0+1)*1110011
00
(0+1)*11100
13-38 (0+1)*1101100 14-47 16-23 (0+1)*1110100
01
(0+1)*11100
13-39 (0+1)*1101101 14-48 16-24 (0+1)*1110101
10
(0+1)*11100
13-40 (0+1)*1101110 14-49 16-25 (0+1)*1110110
11
(0+1)*11101
13-41 (0+1)*1101111 14-50 16-26 (0+1)*1110111
00
(0+1)*11101
13-42 (0+1)*1110000 15-16 16-27 (0+1)*1111000
01
(0+1)*11101
13-43 (0+1)*1110001 15-17 16-28 (0+1)*1111001
10
(0+1)*11101
13-44 (0+1)*1110010 15-18 16-29 (0+1)*1111010
11
(0+1)*11110
13-45 (0+1)*1110011 15-19 16-30 (0+1)*1111011
00
(0+1)*11110
13-46 (0+1)*1110100 15-20 16-31 (0+1)*1111100
01
(0+1)*11110
13-47 (0+1)*1110101 15-21 16-32 (0+1)*1111101
10
pg. 38
Combination R.E. Combination R.E. Combination R.E.
(0+1)*11110
13-48 (0+1)*1110110 15-22 16-33 (0+1)*1111110
11
(0+1)*11111
13-49 (0+1)*1110111 15-23 16-34 (0+1)*1111111
00
(0+1)*11111
13-50 (0+1)*1111000 15-24 16-35 (0+1)*00000000
01
(0+1)*11111
14-15 (0+1)*1111001 15-25 16-36 (0+1)*00000001
10
(0+1)*11111
14-16 (0+1)*1100110 15-26 16-37 (0+1)*00000010
11
(0+1)*11010
14-17 (0+1)*1100111 15-27 16-38 (0+1)*1101110
11
(0+1)*11011
14-18 (0+1)*1101000 15-28 16-39 (0+1)*1101111
00
(0+1)*11011
14-19 (0+1)*1101001 15-29 16-40 (0+1)*1110000
01
(0+1)*11011
14-20 (0+1)*1101010 15-30 16-41 (0+1)*1110001
10
(0+1)*11011
14-21 (0+1)*1101011 15-31 16-42 (0+1)*1110010
11
(0+1)*11100
14-22 (0+1)*1101100 15-32 16-43 (0+1)*1110011
00
(0+1)*11100
14-23 (0+1)*1101101 15-33 16-44 (0+1)*1110100
01
(0+1)*11100
14-24 (0+1)*1101110 15-34 16-45 (0+1)*1110101
10
(0+1)*11100
14-25 (0+1)*1101111 15-35 16-46 (0+1)*1110110
11
(0+1)*11101
14-26 (0+1)*1110000 15-36 16-47 (0+1)*1110111
00
(0+1)*11101
14-27 (0+1)*1110001 15-37 16-48 (0+1)*1111000
01
(0+1)*11101
14-28 (0+1)*1110010 15-38 16-49 (0+1)*1111001
10
(0+1)*11101
14-29 (0+1)*1110011 15-39 16-50 (0+1)*1111010
11
(0+1)*11110
14-30 (0+1)*1110100 15-40 17-18 (0+1)*1111011
00
(0+1)*11110
14-31 (0+1)*1110101 15-41 17-19 (0+1)*1111100
01
(0+1)*11110
14-32 (0+1)*1110110 15-42 17-20 (0+1)*1111101
10
(0+1)*11110
14-33 (0+1)*1110111 15-43 17-21 (0+1)*1111110
11
(0+1)*11111
14-34 (0+1)*1111000 15-44 17-22 (0+1)*1111111
00
pg. 39
Combination R.E. Combination R.E. Combination R.E.
(0+1)*11111
14-35 (0+1)*1111001 15-45 17-23 (0+1)*00000000
01
(0+1)*11111
14-36 (0+1)*1100110 15-46 17-24 (0+1)*00000001
10
(0+1)*11111
14-37 (0+1)*1100111 15-47 17-25 (0+1)*00000010
11
(0+1)*11010
14-38 (0+1)*1101000 15-48 17-26 (0+1)*1101110
11
(0+1)*11011
14-39 (0+1)*1101001 15-49 17-27 (0+1)*1101111
00
(0+1)*11011
14-40 (0+1)*1101010 15-50 17-28 (0+1)*1110000
01
(0+1)*00000
17-29 (0+1)*1110001 18-43 20-27 (0+1)*00101001
100
(0+1)*00000
17-30 (0+1)*1110010 18-44 20-28 (0+1)*00101010
101
(0+1)*00000
17-31 (0+1)*1110011 18-45 20-29 (0+1)*00101011
110
(0+1)*00000
17-32 (0+1)*1110100 18-46 20-30 (0+1)*00101100
111
(0+1)*00001
17-33 (0+1)*1110101 18-47 20-31 (0+1)*00101101
000
(0+1)*00001
17-34 (0+1)*1110110 18-48 20-32 (0+1)*00101110
001
(0+1)*00001
17-35 (0+1)*1110111 18-49 20-33 (0+1)*00101111
010
(0+1)*00001
17-36 (0+1)*1111000 18-50 20-34 (0+1)*00110000
011
(0+1)*00001
17-37 (0+1)*1111001 19-20 20-35 (0+1)*00110001
100
(0+1)*00001
17-38 (0+1)*1111010 19-21 20-36 (0+1)*00110010
101
(0+1)*00001
17-39 (0+1)*1111011 19-22 20-37 (0+1)*00110011
110
(0+1)*00001
17-40 (0+1)*1111100 19-23 20-38 (0+1)*00110100
111
(0+1)*00010
17-41 (0+1)*1111101 19-24 20-39 (0+1)*00110101
000
(0+1)*00010
17-42 (0+1)*1111110 19-25 20-40 (0+1)*00110110
001
(0+1)*00010
17-43 (0+1)*1111111 19-26 20-41 (0+1)*00110111
010
(0+1)*0000000 (0+1)*00010
17-44 19-27 20-42 (0+1)*00111000
0 011
(0+1)*0000000 (0+1)*00010
17-45 19-28 20-43 (0+1)*00111001
1 100
pg. 40
Combination R.E. Combination R.E. Combination R.E.
(0+1)*0000001 (0+1)*00010
17-46 19-29 20-44 (0+1)*00111010
0 101
(0+1)*0000001 (0+1)*00010
17-47 19-30 20-45 (0+1)*00111011
1 110
(0+1)*0000010 (0+1)*00010
17-48 19-31 20-46 (0+1)*00111100
0 111
(0+1)*0000010 (0+1)*00011
17-49 19-32 20-47 (0+1)*00111101
1 000
(0+1)*0000011 (0+1)*00011
17-50 19-33 20-48 (0+1)*00111110
0 001
(0+1)*0000011 (0+1)*00011
18-19 19-34 20-49 (0+1)*00111111
1 010
(0+1)*0000100 (0+1)*00011
18-20 19-35 20-50 (0+1)*01000000
0 011
(0+1)*0000100 (0+1)*00011
18-21 19-36 21-22 (0+1)*01000001
1 100
(0+1)*0000101 (0+1)*00011
18-22 19-37 21-23 (0+1)*01000010
0 101
(0+1)*00011
18-23 (0+1)*1110001 19-38 21-24 (0+1)*01000011
110
(0+1)*00011
18-24 (0+1)*1110010 19-39 21-25 (0+1)*00101001
111
(0+1)*00100
18-25 (0+1)*1110011 19-40 21-26 (0+1)*00101010
000
(0+1)*00100
18-26 (0+1)*1110100 19-41 21-27 (0+1)*00101011
001
(0+1)*00100
18-28 (0+1)*1110101 19-42 21-28 (0+1)*00101100
010
(0+1)*00100
18-29 (0+1)*1110110 19-43 21-29 (0+1)*00101101
011
(0+1)*00100
18-30 (0+1)*1110111 19-44 21-30 (0+1)*00101110
100
(0+1)*00100
18-31 (0+1)*1111000 19-45 21-31 (0+1)*00101111
101
(0+1)*00100
18-32 (0+1)*1111001 19-46 21-32 (0+1)*00110000
110
(0+1)*00100
18-33 (0+1)*1111010 19-47 21-33 (0+1)*00110001
111
(0+1)*00101
18-34 (0+1)*1111011 19-48 21-34 (0+1)*00110010
000
(0+1)*00101
18-35 (0+1)*1111100 19-49 21-35 (0+1)*00110011
001
(0+1)*00101
18-36 (0+1)*1111101 19-50 21-36 (0+1)*00110100
010
(0+1)*00101
18-37 (0+1)*1111110 20-21 21-37 (0+1)*00110101
011
pg. 41
Combination R.E. Combination R.E. Combination R.E.
(0+1)*00000
18-38 (0+1)*1111111 20-22 21-38 (0+1)*00110110
100
(0+1)*0000000 (0+1)*00000
18-39 20-23 21-39 (0+1)*00110111
0 101
(0+1)*0000000 (0+1)*00000
18-40 20-24 21-40 (0+1)*00111000
1 110
(0+1)*0000001 (0+1)*00000
18-41 20-25 21-41 (0+1)*00111001
0 111
(0+1)*0000001 (0+1)*00001
18-42 20-26 21-42 (0+1)*00111010
1 000
(0+1)*0011101 (0+1)*01001
21-43 23-33 25-27 (0+1)*01011110
1 100
(0+1)*0011110 (0+1)*01001
21-44 23-34 25-28 (0+1)*01011111
0 101
(0+1)*0011110 (0+1)*01001
21-45 23-35 25-29 (0+1)*01100000
1 110
(0+1)*0011111 (0+1)*01001
21-46 23-36 25-30 (0+1)*01100001
0 111
(0+1)*0011111 (0+1)*01010
21-47 23-37 25-31 (0+1)*01100010
1 000
(0+1)*0100000 (0+1)*01010
21-48 23-38 25-32 (0+1)*01100011
0 001
(0+1)*0100000 (0+1)*01010
21-49 23-39 25-33 (0+1)*01100100
1 010
(0+1)*0100001 (0+1)*01010
21-50 23-40 25-34 (0+1)*01100101
0 011
(0+1)*0100001 (0+1)*01010
22-23 23-41 25-35 (0+1)*01100110
1 100
(0+1)*0100010 (0+1)*01010
22-24 23-42 25-36 (0+1)*01100111
0 101
(0+1)*0100010 (0+1)*01010
22-25 23-43 25-37 (0+1)*01101000
1 110
(0+1)*0100011 (0+1)*01010
22-26 23-44 25-38 (0+1)*01101001
0 111
(0+1)*0100011 (0+1)*01011
22-27 23-45 25-39 (0+1)*01101010
1 000
(0+1)*0100100 (0+1)*01011
22-28 23-46 25-40 (0+1)*01101011
0 001
(0+1)*0100100 (0+1)*01011
22-29 23-47 25-41 (0+1)*01101100
1 010
(0+1)*0100101 (0+1)*01011
22-30 23-48 25-42 (0+1)*01101101
0 011
(0+1)*0100101 (0+1)*01011
22-31 23-49 25-43 (0+1)*01101110
1 100
(0+1)*0100110 (0+1)*01011
22-32 23-50 25-44 (0+1)*01101111
0 101
pg. 42
Combination R.E. Combination R.E. Combination R.E.
(0+1)*0100110 (0+1)*01011
22-33 24-25 25-47 (0+1)*01110000
1 110
(0+1)*0100111 (0+1)*01011
22-34 24-26 25-48 (0+1)*01110001
0 111
(0+1)*0100111 (0+1)*01100
22-35 24-27 25-49 (0+1)*01110010
1 000
(0+1)*0101000 (0+1)*01100
22-36 24-28 26-27 (0+1)*01110011
0 001
(0+1)*0011101 (0+1)*01100
22-37 24-29 26-28 (0+1)*01110100
1 010
(0+1)*0011110 (0+1)*01100
22-38 24-30 26-29 (0+1)*01110101
0 011
(0+1)*0011110 (0+1)*01100
22-39 24-31 26-30 (0+1)*01110110
1 100
(0+1)*0011111 (0+1)*01100
22-40 24-32 26-31 (0+1)*01110111
0 101
(0+1)*0011111 (0+1)*01100
22-41 24-33 26-32 (0+1)*01111000
1 110
(0+1)*0100000 (0+1)*01001
22-42 24-34 26-33 (0+1)*01011110
0 100
(0+1)*0100000 (0+1)*01001
22-43 24-35 26-34 (0+1)*01011111
1 101
(0+1)*0100001 (0+1)*01001
22-44 24-36 26-35 (0+1)*01100000
0 110
(0+1)*0100001 (0+1)*01001
22-45 24-37 26-36 (0+1)*01100001
1 111
(0+1)*0100010 (0+1)*01010
22-46 24-38 26-37 (0+1)*01100010
0 000
(0+1)*0100010 (0+1)*01010
22-47 24-39 26-38 (0+1)*01100011
1 001
(0+1)*0100011 (0+1)*01010
22-48 24-40 26-39 (0+1)*01100100
0 010
(0+1)*0100011 (0+1)*01010
22-49 24-41 26-40 (0+1)*01100101
1 011
(0+1)*0100100 (0+1)*01010
22-50 24-42 26-41 (0+1)*01100110
0 100
(0+1)*0100100 (0+1)*01010
23-24 24-43 26-42 (0+1)*01100111
1 101
(0+1)*0100101 (0+1)*01010
23-25 24-44 26-43 (0+1)*01101000
0 110
(0+1)*0100101 (0+1)*01010
23-26 24-45 26-44 (0+1)*01101001
1 111
(0+1)*0100110 (0+1)*01011
23-27 24-46 26-45 (0+1)*01101010
0 000
(0+1)*0100110 (0+1)*01011
23-28 24-47 26-46 (0+1)*01101011
1 001
pg. 43
Combination R.E. Combination R.E. Combination R.E.
(0+1)*0100111 (0+1)*01011
23-29 24-48 26-47 (0+1)*01101100
0 010
(0+1)*0100111 (0+1)*01011
23-30 24-49 26-48 (0+1)*01101101
1 011
(0+1)*0101000 (0+1)*01011
23-31 24-50 26-49 (0+1)*01101110
0 100
(0+1)*0011101 (0+1)*01011
23-32 25-26 26-50 (0+1)*01101111
1 101
(0+1)*0111000 (0+1)*01110
27-28 29-30 31-36 (0+1)*10100010
0 101
(0+1)*0111000 (0+1)*01110
27-29 29-31 31-37 (0+1)*10100011
1 110
(0+1)*0111001 (0+1)*01110
27-30 29-32 31-38 (0+1)*10100100
0 111
(0+1)*0111001 (0+1)*01111
27-31 29-33 31-39 (0+1)*10100101
1 000
(0+1)*0111010 (0+1)*01111
27-32 29-34 31-40 (0+1)*10100110
0 001
(0+1)*0111010 (0+1)*01111
27-33 29-35 31-41 (0+1)*10100111
1 010
(0+1)*0111011 (0+1)*01111
27-34 29-36 31-42 (0+1)*10101000
0 011
(0+1)*0111011 (0+1)*01111
27-35 29-37 31-43 (0+1)*10101001
1 100
(0+1)*0111100 (0+1)*01111
27-36 29-38 31-44 (0+1)*10101010
0 101
(0+1)*0111100 (0+1)*01111
27-37 29-39 31-45 (0+1)*10101011
1 110
(0+1)*0111101 (0+1)*01111
27-38 29-40 31-46 (0+1)*10101100
0 111
(0+1)*0111101 (0+1)*10000
27-39 29-41 31-47 (0+1)*10101101
1 000
(0+1)*0111110 (0+1)*10000
27-40 29-42 31-48 (0+1)*10101110
0 001
(0+1)*0111110 (0+1)*10000
27-41 29-43 31-49 (0+1)*10101111
1 010
(0+1)*0111111 (0+1)*10000
27-42 29-44 31-50 (0+1)*10110000
0 011
(0+1)*0111111 (0+1)*10000
27-43 29-45 32-33 (0+1)*10110001
1 100
(0+1)*1000000 (0+1)*10000
27-44 29-46 32-34 (0+1)*10110010
0 101
(0+1)*1000000 (0+1)*10000
27-45 29-47 32-35 (0+1)*10110011
1 110
(0+1)*1000001 (0+1)*10000
27-46 29-48 32-36 (0+1)*10110100
0 111
pg. 44
Combination R.E. Combination R.E. Combination R.E.
(0+1)*1000001 (0+1)*10001
27-47 29-49 32-37 (0+1)*10110101
1 000
(0+1)*1000010 (0+1)*10001
27-48 29-50 32-38 (0+1)*10110110
0 001
(0+1)*1000010 (0+1)*10001
27-49 30-31 32-39 (0+1)*10110111
1 010
(0+1)*1000011 (0+1)*10001
27-50 30-32 32-40 (0+1)*10111000
0 011
(0+1)*1000011 (0+1)*10001
28-29 30-33 32-41 (0+1)*10111001
1 100
(0+1)*1000100 (0+1)*10001
28-30 30-34 32-42 (0+1)*10111010
0 101
(0+1)*1000100 (0+1)*10001
28-31 30-35 32-43 (0+1)*10111011
1 110
(0+1)*1000101 (0+1)*10001
28-32 30-36 32-44 (0+1)*10111100
0 111
(0+1)*1000101 (0+1)*10010
28-33 30-37 32-45 (0+1)*10111101
1 000
(0+1)*1000110 (0+1)*10010
28-34 30-38 32-46 (0+1)*10111110
0 001
(0+1)*1000110 (0+1)*10010
28-35 30-39 32-47 (0+1)*10111111
1 010
(0+1)*1000111 (0+1)*10010
28-36 30-40 32-48 (0+1)*11000000
0 011
(0+1)*1000111 (0+1)*10010
28-37 30-41 32-49 (0+1)*11000001
1 100
(0+1)*1001000 (0+1)*10010
28-38 30-42 32-50 (0+1)*11000010
0 101
(0+1)*1001000 (0+1)*10010
28-39 30-43 33-34 (0+1)*11000011
1 110
(0+1)*1001001 (0+1)*10010
28-40 30-44 33-35 (0+1)*11000100
0 111
(0+1)*1001001 (0+1)*10011
28-41 30-45 33-36 (0+1)*11000101
1 000
(0+1)*1001010 (0+1)*10011
28-42 30-46 33-37 (0+1)*10100010
0 001
(0+1)*1001010 (0+1)*10011
28-43 30-47 33-38 (0+1)*10100011
1 010
(0+1)*1001011 (0+1)*10011
28-44 30-48 33-39 (0+1)*10100100
0 011
(0+1)*1001011 (0+1)*10011
28-45 30-49 33-40 (0+1)*10100101
1 100
(0+1)*0111000 (0+1)*10011
28-46 30-50 33-41 (0+1)*10100110
0 101
(0+1)*0111000 (0+1)*10011
28-47 31-32 33-42 (0+1)*10100111
1 110
pg. 45
Combination R.E. Combination R.E. Combination R.E.
(0+1)*0111001 (0+1)*10011
28-48 31-33 33-43 (0+1)*10101000
0 111
(0+1)*0111001 (0+1)*10100
28-49 31-34 33-44 (0+1)*10101001
1 000
(0+1)*0111010 (0+1)*10100
28-50 31-35 33-45 (0+1)*10101010
0 001
(0+1)*1010101 (0+1)*11011 (0+1)*00000010
33-46 36-46 40-45
1 000 1
(0+1)*1010110 (0+1)*11011 (0+1)*00000011
33-47 36-47 40-46
0 001 0
(0+1)*1010110 (0+1)*11011 (0+1)*00000011
33-48 36-48 40-47
1 010 1
(0+1)*1010111 (0+1)*11011 (0+1)*00000100
33-49 36-49 40-48
0 011 0
(0+1)*1010111 (0+1)*11011 (0+1)*00000100
33-50 36-50 40-49
1 100 1
(0+1)*1011000 (0+1)*11011 (0+1)*00000101
34-35 37-38 40-50
0 101 0
(0+1)*1011000 (0+1)*11011 (0+1)*00000101
34-36 37-39 41-42
1 110 1
(0+1)*1011001 (0+1)*11011 (0+1)*00000110
34-37 37-40 41-43
0 111 0
(0+1)*1011001 (0+1)*11100 (0+1)*00000110
34-38 37-41 41-44
1 000 1
(0+1)*1011010 (0+1)*11100 (0+1)*00000111
34-39 37-42 41-45
0 001 0
(0+1)*1011010 (0+1)*11100 (0+1)*00000111
34-40 37-43 41-46
1 010 1
(0+1)*1011011 (0+1)*11100 (0+1)*00001000
34-41 37-44 41-47
0 011 0
(0+1)*1011011 (0+1)*11100 (0+1)*00001000
34-42 37-45 41-48
1 100 1
(0+1)*1011100 (0+1)*11100 (0+1)*00001001
34-43 37-46 41-49
0 101 0
(0+1)*1011100 (0+1)*11100 (0+1)*00001001
34-44 37-47 41-50
1 110 1
(0+1)*1011101 (0+1)*11100 (0+1)*00001010
34-45 37-48 42-43
0 111 0
(0+1)*1011101 (0+1)*11101 (0+1)*00001010
34-46 37-49 42-44
1 000 1
(0+1)*1011110 (0+1)*11101 (0+1)*00001011
34-47 37-50 42-45
0 001 0
(0+1)*1011110 (0+1)*11101 (0+1)*00001011
34-48 38-39 42-46
1 010 1
(0+1)*1011111 (0+1)*11101 (0+1)*00001100
34-49 38-40 42-47
0 011 0
pg. 46
Combination R.E. Combination R.E. Combination R.E.
(0+1)*1011111 (0+1)*11101 (0+1)*00001100
34-50 38-41 42-48
1 100 1
(0+1)*1100000 (0+1)*11101 (0+1)*00001101
35-36 38-42 42-49
0 101 0
(0+1)*1100000 (0+1)*11101 (0+1)*00001101
35-37 38-43 42-50
1 110 1
(0+1)*1100001 (0+1)*11101 (0+1)*00001110
35-38 38-44 43-44
0 111 0
(0+1)*1100001 (0+1)*11110 (0+1)*00001110
35-39 38-45 43-45
1 000 1
(0+1)*1100010 (0+1)*11110 (0+1)*00001111
35-40 38-46 43-46
0 001 0
(0+1)*1100010 (0+1)*11110 (0+1)*00001111
35-41 38-47 43-47
1 010 1
(0+1)*1100011 (0+1)*11110 (0+1)*00010000
35-42 38-48 43-48
0 011 0
(0+1)*1100011 (0+1)*11110 (0+1)*00010000
35-43 38-49 43-49
1 100 1
(0+1)*1100100 (0+1)*11110 (0+1)*00010001
35-44 38-50 43-50
0 101 0
(0+1)*1100100 (0+1)*11110 (0+1)*00010001
35-45 39-40 44-45
1 110 1
(0+1)*1100101 (0+1)*11110 (0+1)*00010010
35-46 39-41 44-46
0 111 0
(0+1)*1100101 (0+1)*11111 (0+1)*00010010
35-47 39-42 44-47
1 000 1
(0+1)*1100110 (0+1)*11111 (0+1)*00010011
35-48 39-43 44-48
0 001 0
(0+1)*1100110 (0+1)*11111 (0+1)*00010011
35-49 39-44 44-49
1 010 1
(0+1)*1100111 (0+1)*11111 (0+1)*00010100
35-50 39-45 44-50
0 011 0
(0+1)*1100111 (0+1)*11111 (0+1)*00010100
36-37 39-46 45-46
1 100 1
(0+1)*1101000 (0+1)*11111 (0+1)*00010101
36-38 39-47 45-47
0 101 0
(0+1)*1101000 (0+1)*11111 (0+1)*00010101
36-39 39-48 45-48
1 110 1
(0+1)*1101001 (0+1)*11111 (0+1)*00010110
36-40 39-49 45-49
0 111 0
(0+1)*1101001 (0+1)*00000 (0+1)*00010110
36-41 39-50 45-50
1 0000 1
(0+1)*1101010 (0+1)*00000 (0+1)*00010111
36-42 40-41 46-47
0 0001 0
(0+1)*1101010 (0+1)*00000 (0+1)*00010111
36-43 40-42 46-48
1 0010 1
pg. 47
Combination R.E. Combination R.E. Combination R.E.
(0+1)*1101011 (0+1)*00000 (0+1)*00011000
36-44 40-43 46-49
0 0011 0
(0+1)*1101011 (0+1)*00000 (0+1)*00011000
36-45 40-44 46-50
1 0100 1
(0+1)*0001100 (0+1)*00011 (0+1)*00011011
47-48 47-50 48-50
11 0101 1
(0+1)*0001101 (0+1)*00011 (0+1)*00011100
47-49 48-49 49-50
00 0110 0
pg. 48
Uppaal XML Code
<nta>
<template>
</location>
<init ref="id0"/>
<transition>
<source ref="id0"/>
<target ref="id0"/>
</transition>
</template>
Process = Template();
system Process;
pg. 49
</system>
<queries>
</queries>
</nta>
<nta>
<template>
</location>
</location>
<init ref="id1"/>
<transition>
<source ref="id0"/>
<target ref="id1"/>
</transition>
<transition>
pg. 50
<source ref="id0"/>
<target ref="id0"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id1"/>
</transition>
<transition>
<source ref="id1"/>
<target ref="id0"/>
</transition>
</template>
Process = Template();
system Process;
</system>
<queries>
</queries>
pg. 51
</nta>
Token Recognizor
Code:
#include <iostream>
#include <string>
#include <map>
int main() {
std::map<std::string, std::string> commandMapping;
// Populate the command mapping
commandMapping["#id."] = "#include<iostream>";
commandMapping["nameui."] = "using namespace std;";
commandMapping["imain."] = "int main()";
commandMapping["endbri"] = "}";
commandMapping["strbri"] = "{";
commandMapping["ritsemi"] = "return 0;";
commandMapping["brsemi"] = "break;";
commandMapping["psemi"] = ";";
commandMapping["abrik"] = "array[]";
commandMapping["pic"] = "public:";
commandMapping["pri"] = "private:";
commandMapping["csemi"] = "class MyClass{};";
commandMapping["istr"] = "int*";
commandMapping["iref"] = "int&";
commandMapping["mcobj"] = "Myclass obj";
commandMapping["is"] = "this->";
commandMapping["fin."] = "func()";
commandMapping["dwil"] = "do{}while();";
commandMapping["sfi"] = "/*";
commandMapping["cmi"] = "//";
pg. 52
commandMapping["eli"] = "endl";
commandMapping["ain"] = "&&";
commandMapping["ire"] = "||";
commandMapping["eiei"] = "==";
commandMapping["nei"] = "!=";
commandMapping["lei"] = "<=";
commandMapping["gei"] = ">=";
commandMapping["pei"] = "+=";
std::string userInput;
std::cout << "Enter a command abbreviation: ";
std::cin >> userInput;
// Check if the user input exists in the mapping
if (commandMapping.find(userInput) != commandMapping.end()) {
std::cout << "Relative command: " << commandMapping[userInput] << std::endl;
} else {
std::cout << "Command not found." << std::endl;
}
return 0;
}
pg. 53
Lab # 07
Program:
#include <iostream>
#include <string>
using namespace std;
class Command {
public:
string commandName;
string regularExpression;
string controlLanguage;
string bindCommand;
string controlString;
Command(string cName, string rExp, string cLang, string bCommand, string cString)
: commandName(cName), regularExpression(rExp), controlLanguage(cLang),
bindCommand(bCommand), controlString(cString) {}
};
int main() {
Command commands[] = {
Command("#include<iostream>", "(a+b)*", "(0+1)*0(0+1)*", "#id.", "0"),
Command("using namespace std;", "(a+b)*", "(0+1)*1(0+1)*", "nameui.", "1"),
Command("int main()", "(a+b)*", "(0+1)*00(0+1)*", "imain.", "00"),
Command("{", "(a+b)*", "(0+1)*01(0+1)*", "strbri", "01"),
Command("}", "(a+b)*", "(0+1)*10(0+1)*", "endbri", "10"),
Command("cout<<", "(a+b)*", "(0+1)*11(0+1)*", "print", "11"),
Command(";", "(a+b)*", "(0+1)*000(0+1)*", "semi", "000"),
Command("\"", "a(a+b)*", "(0+1)*001(0+1)*", "strin", "001"),
Command("\"", "(a+b)*", "(0+1)*010(0+1)*", "endin", "010"),
Command("'", "a(a+b)*b", "(0+1)*011(0+1)*", "strlin", "011"),
pg. 54
Command("'", "b(a+b)*a", "(0+1)*100(0+1)*", "endlin", "100"),
Command("int", "(a+b)*", "(0+1)*101(0+1)*", "i", "101"),
Command("float", "(a+b)*", "(0+1)*110(0+1)*", "fli", "110"),
Command("double", "(a+b)*", "(0+1)*111(0+1)*", "dli", "111"),
Command("char", "(a+b)*", "(0+1)*0000(0+1)*", "chi", "0000"),
Command("bool", "(a+b)*", "(0+1)*0001(0+1)*", "bli", "0001"),
Command("string", "(a+b)*", "(0+1)*0010(0+1)*", "sri", "0010"),
Command("//", "(a+b)*", "(0+1)*0011(0+1)*", "cmi", "0011"),
Command("cin>>", "(a+b)*", "(0+1)*0100(0+1)*", "in", "0100"),
Command("const", "(a+b)*", "(0+1)*0101(0+1)*", "cist", "0101"),
Command("static", "(a+b)*", "(0+1)*0110(0+1)*", "sti", "0110"),
Command("if()", "(a+b)*", "(0+1)*0111(0+1)*", "fi", "0111"),
Command("else", "(a+b)*", "(0+1)*1000(0+1)*", "ils", "1000"),
Command("while()", "(a+b)*", "(0+1)*1001(0+1)*", "wil", "1001"),
Command("for()", "(a+b)*", "(0+1)*1010(0+1)*", "fire", "1010"),
Command("switch", "(a+b)*", "(0+1)*1011(0+1)*", "site", "1011"),
Command("case 1:", "(a+b)*", "(0+1)*1100(0+1)*", "size", "1100"),
Command("break;", "(a+b)*", "(0+1)*1101(0+1)*", "brsemi", "1101"),
Command("return 0;", "(a+b)*", "(0+1)*1110(0+1)*", "ritsemi", "1110"),
Command("x++;", "(a+b)*", "(0+1)*1111(0+1)*", "psemi", "1111"),
Command("x--;", "(a+b)*", "(0+1)*00000(0+1)*", "nsemi", "00000"),
Command("array[]", "(a+b)*", "(0+1)*00001(0+1)*", "abrik", "00001"),
Command("public:", "(a+b)*", "(0+1)*00010(0+1)*", "pic", "00010"),
Command("private:", "(a+b)*", "(0+1)*00011(0+1)*", "pri", "00011"),
Command("class MyClass{};", "(a+b)*", "(0+1)*00100(0+1)*", "csemi", "00100"),
Command("int*", "(a+b)*", "(0+1)*00101(0+1)*", "istr", "00101"),
Command("int&", "(a+b)*", "(0+1)*00110(0+1)*", "iref", "00110"),
Command("Myclass obj", "(a+b)*", "(0+1)*00111(0+1)*", "mcobj", "00111"),
Command("this->", "(a+b)*", "(0+1)*01000(0+1)*", "is", "01000"),
Command("func()", "(a+b)*", "(0+1)*01001(0+1)*", "fin.", "01001"),
pg. 55
Command("do{}while();", "(a+b)*", "(0+1)*01010(0+1)*", "dwil", "01010"),
Command("/*", "(a+b)*", "(0+1)*01011(0+1)*", "sfi", "01011"),
Command("endl", "(a+b)*", "(0+1)*01100(0+1)*", "eli", "01100"),
Command("&&", "(a+b)*", "(0+1)*01101(0+1)*", "ain", "01101"),
Command("||", "(a+b)*", "(0+1)*01110(0+1)*", "ire", "01110"),
Command("==", "(a+b)*", "(0+1)*01111(0+1)*", "eiei", "01111"),
Command("!=", "(a+b)*", "(0+1)*10000(0+1)*", "nei", "10000"),
Command("<=", "(a+b)*", "(0+1)*10001(0+1)*", "lei", "10001"),
Command(">=", "(a+b)*", "(0+1)*10010(0+1)*", "gei", "10010"),
Command("+=", "(a+b)*", "(0+1)*10011(0+1)*", "pei", "10011"),
};
string searchControlString;
while (true) {
cout << "Enter a control string to search (or type 'exit' to quit): ";
cin >> searchControlString;
if (searchControlString == "exit") {
break;
}
bool found = false;
for (int i = 0; i < sizeof(commands) / sizeof(commands[0]); i++) {
if (commands[i].controlString == searchControlString) {
found = true;
cout << "Command Name: " << commands[i].commandName << endl;
cout << "Regular Expression: " << commands[i].regularExpression << endl;
cout << "Control Language: " << commands[i].controlLanguage << endl;
cout << "Binding Command: " << commands[i].bindCommand << endl;
cout << "Control Strings: " << commands[i].controlString << endl;
break;
}
pg. 56
}
if (!found) {
cout << "Control string not found." << endl;
}
}
return 0;
}
pg. 57
Lab # 09
Simple Persistent Symbol Table:
Shared namespace:
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_SIZE = 50;
const int MAX_VERSIONS = 50;
set<string> allowedWords = {
"#id.", "nameui.", "imain.", "strbri", "endbri", "print", "semi", "strin",
"endin", "strlin", "endlin", "i", "fli", "dli", "chi", "bli", "sri", "cmi",
"in", "cist", "sti", "fi", "ils", "wil", "fire", "site", "size", "brsemi",
"ritsemi", "psemi", "nsemi", "abrik", "pic", "pri", "csemi", "istr", "iref",
"mcobj", "is", "fin.", "dwil", "sfi", "eli", "ain", "ire", "eiei", "nei",
"lei", "gei", "pei"
};
set<string> specialWords = {
"adad", "haraf", "jumla"
};
bool isValidInput(const string& input, string& variable) {
istringstream iss(input);
string word;
while (iss >> word) {
if (allowedWords.find(word) != allowedWords.end()) {
// Found a special word, now looking for the following word (variable)
pg. 58
if (iss >> variable) {
// Successfully extracted the variable that follows the special word
return true;
} else {
// No word follows the special word, input is incomplete
return false;
}
}
}
// No special word found, assume input is just a normal word
variable = input;
return true;
}
int checkAndAdd(string versions[MAX_VERSIONS][MAX_SIZE], int currentSize, int&
currentVersion,
const string& input) {
// Check if the string is already in the latest version of the list
for (int i = 0; i < currentSize; ++i) {
if (versions[currentVersion][i] == input) {
return -1; // The string is already in the list
}
}
// Check if there is room for a new version
if (currentVersion >= MAX_VERSIONS - 1) {
cerr << "Version limit reached, cannot add more versions!" << endl;
return -2;
}
// Check if there is room to add another string
if (currentSize >= MAX_SIZE) {
cerr << "List is full, cannot add more items!" << endl;
pg. 59
return -3;
}
// Create a new version by copying the existing version and adding the new string
for (int i = 0; i < currentSize; ++i) {
versions[currentVersion + 1][i] = versions[currentVersion][i];
}
versions[currentVersion + 1][currentSize] = input; // Add the new string at the end of the new
version
currentVersion++; // Move to the new version
return currentVersion; // Return the new version number
}
int main() {
string versions[MAX_VERSIONS][MAX_SIZE];
int currentSize = 0;
int currentVersion = 0;
while (true) {
string input, variable;
cout << "Enter a string to add to the list (type 'exit' to stop): ";
getline(cin, input);
if (input == "exit") {
break;
}
if (!isValidInput(input, variable)) {
cout << "The input is invalid or missing a variable after a special word." << endl;
continue;
}
int versionNumber = checkAndAdd(versions, currentSize, currentVersion, input);
if (versionNumber == -1) {
cout << "String '" << input << "' is already in the latest version of the list." << endl;
} else if (versionNumber >= 0) {
pg. 60
cout << "String '" << input << "' added to a new version of the list: Version " <<
versionNumber << endl;
currentSize++;
}
// Output all versions of the list
for (int v = 0; v <= currentVersion; ++v) {
cout << "\nVersion " << v << " of the list contains:" << endl;
for (int i = 0; i < currentSize; ++i) {
if (!versions[v][i].empty()) {
cout << versions[v][i] << endl;
}
}
}
}
return 0;
}
Separate namespace:
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <vector>
using namespace std;
set<string> allowedWords = {
"#id.", "nameui.", "imain.", "strbri", "endbri", "print", "semi", "strin", "endin",
"strlin", "endlin", "i", "fli", "dli", "chi", "bli", "sri", "cmi", "in", "cist",
"sti", "fi", "ils", "wil", "fire", "site", "size", "brsemi", "ritsemi", "psemi",
"nsemi", "abrik", "pic", "pri", "csemi", "istr", "iref", "mcobj", "is", "fin.",
"dwil", "sfi", "eli", "ain", "ire", "eiei", "nei", "lei", "gei", "pei"
};
pg. 61
set<string> specialWords = {
"adad", "haraf", "jumla"
};
bool isValidInput(const string& input, string& variable, bool& isSpecialWord) {
istringstream iss(input);
string word;
isSpecialWord = false;
while (iss >> word) {
if (allowedWords.find(word) != allowedWords.end()) {
isSpecialWord = true;
if (iss >> variable) {
return true;
} else {
return false;
}
}
}
variable = input;
return true;
}
void addToAppropriateList(vector<string>& specialWordsList, vector<string>& regularWordsList,
const string& input,
bool isSpecialWord) {
if (isSpecialWord) {
specialWordsList.push_back(input);
} else {
regularWordsList.push_back(input);
}
}
int main() {
pg. 62
vector<string> specialWordsList;
vector<string> regularWordsList;
while (true) {
string input, variable;
bool isSpecialWord;
cout << "Enter a string to add to the list (type 'exit' to stop): ";
getline(cin, input);
if (input == "exit") {
break;
}
if (!isValidInput(input, variable, isSpecialWord)) {
cout << "The input is invalid or missing a variable after a variable." << endl;
continue;
}
addToAppropriateList(specialWordsList, regularWordsList, input, isSpecialWord);
cout << "String '" << input << "' added to the " << (isSpecialWord ? "Variable" : "Functions")
<< " list." << endl;
}
cout << "\nVariables List contains:" << endl;
for (const string& word : specialWordsList) {
cout << word << endl;
}
cout << "\nFunctions List contains:" << endl;
for (const string& word : regularWordsList) {
cout << word << endl;
}
return 0;
}
pg. 63
Simple Imperative Symbol Table:
Shared namespace:
#include <iostream>
#include <string>
#include <sstream>
#include <set>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_SIZE = 50;
const int MAX_VERSIONS = 50;
set<string> allowedWords = {
"#id.", "nameui.", "imain.", "strbri", "endbri", "print", "semi",
"strin", "endin", "strlin", "endlin", "i", "fli", "dli", "chi",
"bli", "sri", "cmi", "in", "cist", "sti", "fi", "ils", "wil",
"fire", "site", "size", "brsemi", "ritsemi", "psemi", "nsemi",
"abrik", "pic", "pri", "csemi", "istr", "iref", "mcobj", "is",
"fin.", "dwil", "sfi", "eli", "ain", "ire", "eiei", "nei", "lei",
"gei", "pei"
};
set<string> specialWords = {
"adad", "haraf", "jumla"
};
bool isValidInput(const string& input, string& variable) {
istringstream iss(input);
string word;
while (iss >> word) {
if (specialWords.find(word) != specialWords.end()) {
// Found a special word, now looking for the following word (variable)
pg. 64
if (iss >> variable) {
// Successfully extracted the variable that follows the special word
return true;
} else {
// No word follows the special word, input is incomplete
return false;
}
}
}
// No special word found, assume input is just a normal word
variable = input;
return true;
}
int checkAndAdd(string versions[MAX_VERSIONS][MAX_SIZE], int currentSize, int&
currentVersion, const string& input) {
// Check if the string is already in the latest version of the list
for (int i = 0; i < currentSize; ++i) {
if (versions[currentVersion][i] == input) {
return -1; // The string is already in the list
}
}
// Check if there is room for a new version
if (currentVersion >= MAX_VERSIONS - 1) {
cerr << "Version limit reached, cannot add more versions!" << endl;
return -2;
}
// Check if there is room to add another string
if (currentSize >= MAX_SIZE) {
cerr << "List is full, cannot add more items!" << endl;
return -3;
pg. 65
}
// Create a new version by copying the existing version and adding the new string
for (int i = 0; i < currentSize; ++i) {
versions[currentVersion + 1][i] = versions[currentVersion][i];
}
versions[currentVersion + 1][currentSize] = input; // Add the new string at the end of the new
version
currentVersion++; // Move to the new version
return currentVersion; // Return the new version number
}
int main() {
stack<vector<string>> versions;
versions.push(vector<string>());
while (true) {
string input, variable;
cout << "Enter a string to add to the list (type 'exit' to stop): ";
getline(cin, input);
if (input == "exit") {
break;
}
if (!isValidInput(input, variable)) {
cout << "The input is invalid or missing a variable after a special word." << endl;
continue;
}
if (find(versions.top().begin(), versions.top().end(), input) != versions.top().end()) {
cout << "String '" << input << "' is already in the latest version of the list." << endl;
continue;
}
if (versions.top().size() >= MAX_SIZE) {
pg. 66
cerr << "List is full, cannot add more items!" << endl;
continue;
}
// Create a new version by copying the existing top version and adding the new string
vector<string> newVersion = versions.top();
newVersion.push_back(input);
versions.push(newVersion);
cout << "String '" << input << "' added to a new version of the list." << endl;
// Output all versions of the list
stack<vector<string>> versionsCopy = versions; // make a copy to iterate through
int versionNumber = versions.size() - 1;
while (!versionsCopy.empty()) {
const vector<string>& version = versionsCopy.top();
cout << "\nVersion " << versionNumber << " of the list contains:" << endl;
Separate namespace:
#include <iostream>
#include <string>
#include <sstream>
#include <set>
pg. 67
#include <stack>
using namespace std;
set<string> allowedWords = {
"#id.", "nameui.", "imain.", "strbri", "endbri", "print", "semi", "strin", "endin", "strlin",
"endlin", "i", "fli", "dli", "chi", "bli", "sri", "cmi", "in", "cist", "sti", "fi", "ils", "wil",
"fire", "site", "size", "brsemi", "ritsemi", "psemi", "nsemi", "abrik", "pic", "pri", "csemi",
"istr", "iref", "mcobj", "is", "fin.", "dwil", "sfi", "eli", "ain", "ire", "eiei", "nei", "lei",
"gei", "pei"
};
set<string> specialWords = {
"adad", "haraf", "jumla"
};
bool isValidInput(const string& input, string& variable, bool& isSpecialWord) {
istringstream iss(input);
string word;
isSpecialWord = false;
while (iss >> word) {
if (specialWords.find(word) != specialWords.end()) {
isSpecialWord = true;
if (iss >> variable) {
return true;
} else {
return false;
}
}
}
variable = input;
return true;
}
pg. 68
void pushToAppropriateStack(stack<string>& specialWordsStack, stack<string>&
regularWordsStack, const string& input, bool isSpecialWord) {
if (isSpecialWord) {
specialWordsStack.push(input);
} else {
regularWordsStack.push(input);
}
}
void printStack(stack<string> st) {
while (!st.empty()) {
cout << st.top() << endl;
st.pop(); // Remove the element once it's printed
}
}
int main() {
stack<string> specialWordsStack;
stack<string> regularWordsStack;
while (true) {
string input, variable;
bool isSpecialWord;
cout << "Enter a string to add to the stack (type 'exit' to stop): ";
getline(cin, input);
if (input == "exit") {
break;
}
if (allowedWords.find(input) == allowedWords.end()) {
cout << "Invalid command. Please enter a valid command." << endl;
continue;
}
if (!isValidInput(input, variable, isSpecialWord)) {
pg. 69
cout << "The input is invalid or missing a variable after a special word." << endl;
continue;
}
pushToAppropriateStack(specialWordsStack, regularWordsStack, input, isSpecialWord);
cout << "String '" << input << "' added to the " << (isSpecialWord ? "special" : "regular") <<
" stack." << endl;
}
cout << "\nSpecial Words Stack contains:" << endl;
printStack(specialWordsStack);
cout << "\nRegular Words Stack contains:" << endl;
printStack(regularWordsStack);
return 0;
}
pg. 70
Lab # 11
Program:
#include <iostream>
#include <string>
pg. 71
// Print the CFG rules based on the provided regular expression
if (processingUnit == 1) {
cout << "S=> yA" << endl;
cout << "S=> zB" << endl;
cout << "A=> yC" << endl;
cout << "A=> zD" << endl;
cout << "B=> yA" << endl;
cout << "B=> zB" << endl;
cout << "C=> yC" << endl;
cout << "C=> zD" << endl;
cout << "D=> yC" << endl;
cout << "D=> zD" << endl;
} else if (processingUnit == 2) {
cout << "S=> zS" << endl;
cout << "S=> yA" << endl;
cout << "A=> yB" << endl;
cout << "A=> zS" << endl;
cout << "B=> yB" << endl;
cout << "B=> zS" << endl;
}
}
int main() {
string rePU1, rePU2;
pg. 72
getline(cin, rePU2);
return 0;
}
pg. 73
Lab # 05 [Assignment # 2 Semester Project]
pg. 74
pg. 75
pg. 76
pg. 77
pg. 78
pg. 79
pg. 80
pg. 81
pg. 82
pg. 83
pg. 84
pg. 85
pg. 86
pg. 87
pg. 88
pg. 89
pg. 90
pg. 91
pg. 92
pg. 93
pg. 94
pg. 95
pg. 96
pg. 97
pg. 98
pg. 99
pg. 100
pg. 101
pg. 102
pg. 103
pg. 104
pg. 105